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
if False: # set to True to insert test data store(store.product.id > 0).delete() store(store.category.id > 0).delete() if len(store(store.product.id > 0).select()) == 0: fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg') hp1 = store.product.insert(name="Harry Potter and the Sorcerer's Stone", category=fantasy_id, price=7.91, small_image='testdata/hp1.jpg') hp2 = store.product.insert(name="Harry Potter and the Chamber of Secrets", category=fantasy_id, price=8.91, small_image='testdata/hp2.jpg') hp3 = store.product.insert(name="Harry Potter and the Prisoner of Azkaban", category=fantasy_id, price=8.91, small_image='testdata/hp3.jpg') hp4 = store.product.insert(name="Harry Potter and the Goblet of Fire", category=fantasy_id, price=9.91, small_image='testdata/hp4.jpg') hp5 = store.product.insert(name="Harry Potter and the Order of the Phoenix", category=fantasy_id, price=9.91, small_image='testdata/hp5.jpg') hp6 = store.product.insert(name="Harry Potter and the Half-Blood Prince", category=fantasy_id, price=9.91, small_image='testdata/hp6.jpg') store.option.insert(product=hp1, description='Bookmark', price=1.5) store.option.insert(product=hp1, description='Wizard hat', price=12) for p2 in (hp2, hp3, hp4, hp5, hp6): store.cross_sell.insert(p1=hp1, p2=p2) hp1_hard = store.product.insert(name="Harry Potter and the Sorcerer's Stone [hardcover]", category=fantasy_id, price=15.91, small_image='testdata/hp1.jpg') store.up_sell.insert(product=hp1, better=hp1_hard)
ajibawa-2023/Python-Code-Large/train/row_0
17
20
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "label": "if", "type": "if", "loc": [1, 20], "level": 0, "parent": null, "vector": [4, 0, 0.525, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if False: # set to True to insert test data \n store(store.product.id > 0).delete()\n store(store.category.id > 0).delete()\n if len(store(store.product.id > 0).select()) == 0:\n fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg')\n hp1 = store.product.insert(name=\"Harry Potter and the Sorcerer's Stone\", category=fantasy_id, price=7.91, small_image='testdata/hp1.jpg')\n hp2 = store.product.insert(name=\"Harry Potter and the Chamber of Secrets\", category=fantasy_id, price=8.91, small_image='testdata/hp2.jpg')\n hp3 = store.product.insert(name=\"Harry Potter and the Prisoner of Azkaban\", category=fantasy_id, price=8.91, small_image='testdata/hp3.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L2_C4", "label": "delete()", "type": "expression", "loc": [2, 2], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "vector": [8, 1, 0.1, 0.05, 1, 0.89, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " store(store.product.id > 0).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L3_C4", "label": "delete()", "type": "expression", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "vector": [8, 1, 0.15, 0.05, 1, 0.89, 0.5, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " store(store.category.id > 0).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "label": "if", "type": "if", "loc": [4, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "vector": [4, 1, 0.6, 0.85, 1, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(store(store.product.id > 0).select()) == 0:\n fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg')\n hp1 = store.product.insert(name=\"Harry Potter and the Sorcerer's Stone\", category=fantasy_id, price=7.91, small_image='testdata/hp1.jpg')\n hp2 = store.product.insert(name=\"Harry Potter and the Chamber of Secrets\", category=fantasy_id, price=8.91, small_image='testdata/hp2.jpg')\n hp3 = store.product.insert(name=\"Harry Potter and the Prisoner of Azkaban\", category=fantasy_id, price=8.91, small_image='testdata/hp3.jpg')\n hp4 = store.product.insert(name=\"Harry Potter and the Goblet of Fire\", category=fantasy_id, price=9.91, small_image='testdata/hp4.jpg')\n hp5 = store.product.insert(name=\"Harry Potter and the Order of the Phoenix\", category=fantasy_id, price=9.91, small_image='testdata/hp5.jpg')\n hp6 = store.product.insert(name=\"Harry Potter and the Half-Blood Prince\", category=fantasy_id, price=9.91, small_image='testdata/hp6.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L5_C8", "label": "fantasy_id = insert()", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.25, 0.05, 2, 0.98, 0.0, 50, 3, 3, 0, 0, 368, 10, 1], "semantic": {"name": "fantasy_id", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " fantasy_id = store.category.insert(name='Fantasy', description='Fantasy books', small_image='testdata/hp1.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L6_C8", "label": "hp1 = insert()", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.3, 0.05, 2, 0.98, 0.0909, 386, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp1", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp1 = store.product.insert(name=\"Harry Potter and the Sorcerer's Stone\", category=fantasy_id, price=7.91, small_image='testdata/hp1.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L7_C8", "label": "hp2 = insert()", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.35, 0.05, 2, 0.98, 0.1818, 283, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp2", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp2 = store.product.insert(name=\"Harry Potter and the Chamber of Secrets\", category=fantasy_id, price=8.91, small_image='testdata/hp2.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L8_C8", "label": "hp3 = insert()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.4, 0.05, 2, 0.98, 0.2727, 78, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp3", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp3 = store.product.insert(name=\"Harry Potter and the Prisoner of Azkaban\", category=fantasy_id, price=8.91, small_image='testdata/hp3.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L9_C8", "label": "hp4 = insert()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.45, 0.05, 2, 0.98, 0.3636, 33, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp4", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp4 = store.product.insert(name=\"Harry Potter and the Goblet of Fire\", category=fantasy_id, price=9.91, small_image='testdata/hp4.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L10_C8", "label": "hp5 = insert()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.5, 0.05, 2, 0.98, 0.4545, 517, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp5", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp5 = store.product.insert(name=\"Harry Potter and the Order of the Phoenix\", category=fantasy_id, price=9.91, small_image='testdata/hp5.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L11_C8", "label": "hp6 = insert()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.55, 0.05, 2, 0.98, 0.5455, 686, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp6", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp6 = store.product.insert(name=\"Harry Potter and the Half-Blood Prince\", category=fantasy_id, price=9.91, small_image='testdata/hp6.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L13_C8", "label": "insert()", "type": "expression", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [8, 2, 0.65, 0.05, 2, 0.98, 0.6364, 368, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " store.option.insert(product=hp1, description='Bookmark', price=1.5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L14_C8", "label": "insert()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [8, 2, 0.7, 0.05, 2, 0.98, 0.7273, 368, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " store.option.insert(product=hp1, description='Wizard hat', price=12)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:For_L16_C8", "label": "for p2", "type": "for", "loc": [16, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [6, 2, 0.825, 0.1, 2, 0.98, 0.8182, 843, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "p2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for p2 in (hp2, hp3, hp4, hp5, hp6):\n store.cross_sell.insert(p1=hp1, p2=p2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L17_C12", "label": "insert()", "type": "expression", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:For_L16_C8", "vector": [8, 3, 0.85, 0.05, 3, 0.37, 0.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " store.cross_sell.insert(p1=hp1, p2=p2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L19_C8", "label": "hp1_hard = insert()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [14, 2, 0.95, 0.05, 2, 0.98, 0.9091, 331, 3, 4, 0, 0, 368, 10, 1], "semantic": {"name": "hp1_hard", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " hp1_hard = store.product.insert(name=\"Harry Potter and the Sorcerer's Stone [hardcover]\", category=fantasy_id, price=15.91, small_image='testdata/hp1.jpg')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L20_C8", "label": "insert()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "vector": [8, 2, 1.0, 0.05, 2, 0.98, 1.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " store.up_sell.insert(product=hp1, better=hp1_hard)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:For_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:For_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_0:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_0:Expr_L20_C8"}]
UNDEFINED = -1 if request.env.web2py_runtime_gae: # if running on Google App Engine store = DAL('gae') # connect to Google BigTable session.connect(request, response, db=store) # and store sessions and tickets there else: store = DAL("sqlite://store.db") store.define_table('category', Field('name'), Field('description', 'text'), Field('small_image', 'upload'), ) store.define_table('product', Field('name'), Field('category', store.category), Field('description', 'text', default=''), Field('small_image', 'upload'), Field('large_image', 'upload', default=''), Field('quantity_in_stock', 'integer', default=UNDEFINED), # if UNDEFINED, don't show Field('max_quantity', 'integer', default=0), # maximum quantity that can be purchased in an order. If 0, no limit. If UNDEFINED, don't show. Field('price', 'double', default=1.0), Field('old_price', 'double', default=0.0), Field('weight_in_pounds', 'double', default=1), Field('tax_rate_in_your_state', 'double', default=10.0), Field('tax_rate_outside_your_state', 'double', default=0.0), Field('featured', 'boolean', default=False), Field('allow_rating', 'boolean', default=False), Field('rating', 'integer', default='0'), Field('viewed', 'integer', default='0'), Field('clicked', 'integer', default='0')) # each product can have optional addons store.define_table('option', Field('product', store.product), Field('description'), Field('price', 'double', default=1.0), ) # support for merchandising # for p1 show p2, and for p2 show p1 store.define_table('cross_sell', Field('p1', store.product), Field('p2', store.product), ) # for product, show better, but not the reverse store.define_table('up_sell', Field('product', store.product), Field('better', store.product), ) store.define_table('comment', Field('product', store.product), Field('author'), Field('email'), Field('body', 'text'), Field('rate', 'integer') ) store.define_table('info', Field('google_merchant_id', default='[google checkout id]', length=256), Field('name', default='[store name]'), Field('headline', default='[store headline]'), Field('address', default='[store address]'), Field('city', default='[store city]'), Field('state', default='[store state]'), Field('zip_code', default='[store zip]'), Field('phone', default='[store phone number]'), Field('fax', default='[store fax number]'), Field('email', requires=IS_EMAIL(), default='yourname@yourdomain.com'), Field('description', 'text', default='[about your store]'), Field('why_buy', 'text', default='[why buy at your store]'), Field('return_policy', 'text', default='[what is your return policy]'), Field('logo', 'upload', default=''), Field('color_background', length=10, default='white'), Field('color_foreground', length=10, default='black'), Field('color_header', length=10, default='#F6F6F6'), Field('color_link', length=10, default='#385ea2'), Field('font_family', length=32, default='arial, helvetica'), Field('ship_usps_express_mail', 'boolean', default=True), Field('ship_usps_express_mail_fc', 'double', default=0), Field('ship_usps_express_mail_vc', 'double', default=0), Field('ship_usps_express_mail_bc', 'double', default=0), Field('ship_usps_priority_mail', 'boolean', default=True), Field('ship_usps_priority_mail_fc', 'double', default=0), Field('ship_usps_priority_mail_vc', 'double', default=0), Field('ship_usps_priority_mail_bc', 'double', default=0), Field('ship_ups_next_day_air', 'boolean', default=True), Field('ship_ups_next_day_air_fc', 'double', default=0), Field('ship_ups_next_day_air_vc', 'double', default=0), Field('ship_ups_next_day_air_bc', 'double', default=0), Field('ship_ups_second_day_air', 'boolean', default=True), Field('ship_ups_second_day_air_fc', 'double', default=0), Field('ship_ups_second_day_air_vc', 'double', default=0), Field('ship_ups_second_day_air_bc', 'double', default=0), Field('ship_ups_ground', 'boolean', default=True), Field('ship_ups_ground_fc', 'double', default=0), Field('ship_ups_ground_vc', 'double', default=0), Field('ship_ups_ground_bc', 'double', default=0), Field('ship_fedex_priority_overnight', 'boolean', default=True), Field('ship_fedex_priority_overnight_fc', 'double', default=0), Field('ship_fedex_priority_overnight_vc', 'double', default=0), Field('ship_fedex_priority_overnight_bc', 'double', default=0), Field('ship_fedex_second_day', 'boolean', default=True), Field('ship_fedex_second_day_fc', 'double', default=0), Field('ship_fedex_second_day_vc', 'double', default=0), Field('ship_fedex_second_day_bc', 'double', default=0), Field('ship_fedex_ground', 'boolean', default=True), Field('ship_fedex_ground_fc', 'double', default=0), Field('ship_fedex_ground_vc', 'double', default=0), Field('ship_fedex_ground_bc', 'double', default=0) ) store.category.name.requires = IS_NOT_IN_DB(store, 'category.name') store.product.name.requires = IS_NOT_IN_DB(store, 'product.name') store.product.category.requires = IS_IN_DB(store, 'category.id', 'category.name') store.product.name.requires = IS_NOT_EMPTY() store.product.description.requires = IS_NOT_EMPTY() store.product.quantity_in_stock.requires = IS_INT_IN_RANGE(0, 1000) store.product.price.requires = IS_FLOAT_IN_RANGE(0, 10000) store.product.rating.requires = IS_INT_IN_RANGE(-10000, 10000) store.product.viewed.requires = IS_INT_IN_RANGE(0, 1000000) store.product.clicked.requires = IS_INT_IN_RANGE(0, 1000000) store.option.product.requires = IS_IN_DB(store, 'product.id', 'product.name') store.cross_sell.p1.requires = IS_IN_DB(store, 'product.id', 'product.name') store.cross_sell.p2.requires = IS_IN_DB(store, 'product.id', 'product.name') store.up_sell.product.requires = IS_IN_DB(store, 'product.id', 'product.name') store.up_sell.better.requires = IS_IN_DB(store, 'product.id', 'product.name') store.comment.product.requires = IS_IN_DB(store, 'product.id', 'product.name') store.comment.author.requires = IS_NOT_EMPTY() store.comment.email.requires = IS_EMAIL() store.comment.body.requires = IS_NOT_EMPTY() store.comment.rate.requires = IS_IN_SET(range(5, 0, -1)) for field in store.info.fields: if field[:-2] in ['fc', 'vc']: store.info[field].requires = IS_FLOAT_IN_RANGE(0, 100) if len(store(store.info.id > 0).select()) == 0: store.info.insert(name='[store name]') mystore = store(store.info.id > 0).select()[0]
ajibawa-2023/Python-Code-Large/train/row_1
38
154
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L1_C0", "label": "UNDEFINED =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 67, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "UNDEFINED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "UNDEFINED = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "label": "if", "type": "if", "loc": [4, 8], "level": 0, "parent": null, "vector": [4, 0, 0.039, 0.0325, 0, 0.66, 0.0323, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if request.env.web2py_runtime_gae: # if running on Google App Engine\n store = DAL('gae') # connect to Google BigTable\n session.connect(request, response, db=store) # and store sessions and tickets there\nelse:\n store = DAL(\"sqlite://store.db\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L5_C4", "label": "store = DAL()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "vector": [14, 1, 0.0325, 0.0065, 1, 0.3, 0.0, 354, 3, 1, 0, 0, 18, 10, 1], "semantic": {"name": "store", "arg_names": [], "import_names": [], "rhs_call_name": "DAL", "annotation": ""}, "snippet": " store = DAL('gae') # connect to Google BigTable"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L6_C4", "label": "connect()", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "vector": [8, 1, 0.039, 0.0065, 1, 0.3, 0.5, 242, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " session.connect(request, response, db=store) # and store sessions and tickets there"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L8_C4", "label": "store = DAL()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "vector": [14, 1, 0.0519, 0.0065, 1, 0.3, 1.0, 354, 3, 1, 0, 0, 18, 10, 1], "semantic": {"name": "store", "arg_names": [], "import_names": [], "rhs_call_name": "DAL", "annotation": ""}, "snippet": " store = DAL(\"sqlite://store.db\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L11_C0", "label": "define_table()", "type": "expression", "loc": [11, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0844, 0.0325, 0, 0.66, 0.0645, 874, 3, 4, 0, 0, 0, 0, 4], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('category', \n Field('name'), \n Field('description', 'text'),\n Field('small_image', 'upload'),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L18_C0", "label": "define_table()", "type": "expression", "loc": [18, 35], "level": 0, "parent": null, "vector": [8, 0, 0.1721, 0.1169, 0, 0.66, 0.0968, 874, 3, 18, 0, 0, 0, 0, 18], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('product', \n Field('name'),\n Field('category', store.category),\n Field('description', 'text', default=''),\n Field('small_image', 'upload'),\n Field('large_image', 'upload', default=''),\n Field('quantity_in_stock', 'integer', default=UNDEFINED), # if UNDEFINED, don't show\n Field('max_quantity', 'integer', default=0), # maximum quantity that can be purchased in an order. If 0, no limit. If UNDEFINED, don't show."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L39_C0", "label": "define_table()", "type": "expression", "loc": [39, 43], "level": 0, "parent": null, "vector": [8, 0, 0.2662, 0.0325, 0, 0.66, 0.129, 874, 3, 4, 0, 0, 0, 0, 4], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('option',\n Field('product', store.product),\n Field('description'),\n Field('price', 'double', default=1.0),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L48_C0", "label": "define_table()", "type": "expression", "loc": [48, 51], "level": 0, "parent": null, "vector": [8, 0, 0.3214, 0.026, 0, 0.66, 0.1613, 874, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('cross_sell',\n Field('p1', store.product),\n Field('p2', store.product),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L53_C0", "label": "define_table()", "type": "expression", "loc": [53, 56], "level": 0, "parent": null, "vector": [8, 0, 0.3539, 0.026, 0, 0.66, 0.1935, 874, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('up_sell',\n Field('product', store.product),\n Field('better', store.product),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L59_C0", "label": "define_table()", "type": "expression", "loc": [59, 65], "level": 0, "parent": null, "vector": [8, 0, 0.4026, 0.0455, 0, 0.66, 0.2258, 874, 3, 6, 0, 0, 0, 0, 6], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('comment', \n Field('product', store.product), \n Field('author'), \n Field('email'), \n Field('body', 'text'), \n Field('rate', 'integer')\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L68_C0", "label": "define_table()", "type": "expression", "loc": [68, 122], "level": 0, "parent": null, "vector": [8, 0, 0.6169, 0.3571, 0, 0.66, 0.2581, 874, 3, 52, 0, 0, 0, 0, 53], "semantic": {"name": "define_table", "arg_names": [], "import_names": [], "rhs_call_name": "define_table", "annotation": ""}, "snippet": "store.define_table('info', \n Field('google_merchant_id', default='[google checkout id]', length=256),\n Field('name', default='[store name]'),\n Field('headline', default='[store headline]'), \n Field('address', default='[store address]'), \n Field('city', default='[store city]'), \n Field('state', default='[store state]'), \n Field('zip_code', default='[store zip]'), "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L127_C0", "label": "store.category.name.requires = IS_NOT_IN_DB()", "type": "assigned_variable", "loc": [127, 127], "level": 0, "parent": null, "vector": [14, 0, 0.8247, 0.0065, 0, 0.66, 0.2903, 573, 3, 2, 0, 0, 616, 10, 1], "semantic": {"name": "store.category.name.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_IN_DB", "annotation": ""}, "snippet": "store.category.name.requires = IS_NOT_IN_DB(store, 'category.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L128_C0", "label": "store.product.name.requires = IS_NOT_IN_DB()", "type": "assigned_variable", "loc": [128, 128], "level": 0, "parent": null, "vector": [14, 0, 0.8312, 0.0065, 0, 0.66, 0.3226, 457, 3, 2, 0, 0, 616, 10, 1], "semantic": {"name": "store.product.name.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_IN_DB", "annotation": ""}, "snippet": "store.product.name.requires = IS_NOT_IN_DB(store, 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L129_C0", "label": "store.product.category.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [129, 129], "level": 0, "parent": null, "vector": [14, 0, 0.8377, 0.0065, 0, 0.66, 0.3548, 441, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.product.category.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.product.category.requires = IS_IN_DB(store, 'category.id', 'category.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L130_C0", "label": "store.product.name.requires = IS_NOT_EMPTY()", "type": "assigned_variable", "loc": [130, 130], "level": 0, "parent": null, "vector": [14, 0, 0.8442, 0.0065, 0, 0.66, 0.3871, 457, 3, 0, 0, 0, 509, 10, 1], "semantic": {"name": "store.product.name.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_EMPTY", "annotation": ""}, "snippet": "store.product.name.requires = IS_NOT_EMPTY()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L131_C0", "label": "store.product.description.requires = IS_NOT_EMPTY()", "type": "assigned_variable", "loc": [131, 131], "level": 0, "parent": null, "vector": [14, 0, 0.8506, 0.0065, 0, 0.66, 0.4194, 298, 3, 0, 0, 0, 509, 10, 1], "semantic": {"name": "store.product.description.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_EMPTY", "annotation": ""}, "snippet": "store.product.description.requires = IS_NOT_EMPTY()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L132_C0", "label": "store.product.quantity_in_stock.requires = IS_INT_IN_RANGE()", "type": "assigned_variable", "loc": [132, 132], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.0065, 0, 0.66, 0.4516, 956, 3, 2, 0, 0, 167, 10, 1], "semantic": {"name": "store.product.quantity_in_stock.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_INT_IN_RANGE", "annotation": ""}, "snippet": "store.product.quantity_in_stock.requires = IS_INT_IN_RANGE(0, 1000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L133_C0", "label": "store.product.price.requires = IS_FLOAT_IN_RANGE()", "type": "assigned_variable", "loc": [133, 133], "level": 0, "parent": null, "vector": [14, 0, 0.8636, 0.0065, 0, 0.66, 0.4839, 272, 3, 2, 0, 0, 272, 10, 1], "semantic": {"name": "store.product.price.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_FLOAT_IN_RANGE", "annotation": ""}, "snippet": "store.product.price.requires = IS_FLOAT_IN_RANGE(0, 10000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L134_C0", "label": "store.product.rating.requires = IS_INT_IN_RANGE()", "type": "assigned_variable", "loc": [134, 134], "level": 0, "parent": null, "vector": [14, 0, 0.8701, 0.0065, 0, 0.66, 0.5161, 685, 3, 2, 0, 0, 167, 10, 1], "semantic": {"name": "store.product.rating.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_INT_IN_RANGE", "annotation": ""}, "snippet": "store.product.rating.requires = IS_INT_IN_RANGE(-10000, 10000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L135_C0", "label": "store.product.viewed.requires = IS_INT_IN_RANGE()", "type": "assigned_variable", "loc": [135, 135], "level": 0, "parent": null, "vector": [14, 0, 0.8766, 0.0065, 0, 0.66, 0.5484, 126, 3, 2, 0, 0, 167, 10, 1], "semantic": {"name": "store.product.viewed.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_INT_IN_RANGE", "annotation": ""}, "snippet": "store.product.viewed.requires = IS_INT_IN_RANGE(0, 1000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L136_C0", "label": "store.product.clicked.requires = IS_INT_IN_RANGE()", "type": "assigned_variable", "loc": [136, 136], "level": 0, "parent": null, "vector": [14, 0, 0.8831, 0.0065, 0, 0.66, 0.5806, 413, 3, 2, 0, 0, 167, 10, 1], "semantic": {"name": "store.product.clicked.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_INT_IN_RANGE", "annotation": ""}, "snippet": "store.product.clicked.requires = IS_INT_IN_RANGE(0, 1000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L137_C0", "label": "store.option.product.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [137, 137], "level": 0, "parent": null, "vector": [14, 0, 0.8896, 0.0065, 0, 0.66, 0.6129, 680, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.option.product.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.option.product.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L138_C0", "label": "store.cross_sell.p1.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [138, 138], "level": 0, "parent": null, "vector": [14, 0, 0.8961, 0.0065, 0, 0.66, 0.6452, 505, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.cross_sell.p1.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.cross_sell.p1.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L139_C0", "label": "store.cross_sell.p2.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [139, 139], "level": 0, "parent": null, "vector": [14, 0, 0.9026, 0.0065, 0, 0.66, 0.6774, 187, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.cross_sell.p2.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.cross_sell.p2.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L140_C0", "label": "store.up_sell.product.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [140, 140], "level": 0, "parent": null, "vector": [14, 0, 0.9091, 0.0065, 0, 0.66, 0.7097, 490, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.up_sell.product.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.up_sell.product.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L141_C0", "label": "store.up_sell.better.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [141, 141], "level": 0, "parent": null, "vector": [14, 0, 0.9156, 0.0065, 0, 0.66, 0.7419, 790, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.up_sell.better.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.up_sell.better.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L142_C0", "label": "store.comment.product.requires = IS_IN_DB()", "type": "assigned_variable", "loc": [142, 142], "level": 0, "parent": null, "vector": [14, 0, 0.9221, 0.0065, 0, 0.66, 0.7742, 230, 3, 3, 0, 0, 289, 10, 1], "semantic": {"name": "store.comment.product.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_DB", "annotation": ""}, "snippet": "store.comment.product.requires = IS_IN_DB(store, 'product.id', 'product.name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L143_C0", "label": "store.comment.author.requires = IS_NOT_EMPTY()", "type": "assigned_variable", "loc": [143, 143], "level": 0, "parent": null, "vector": [14, 0, 0.9286, 0.0065, 0, 0.66, 0.8065, 729, 3, 0, 0, 0, 509, 10, 1], "semantic": {"name": "store.comment.author.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_EMPTY", "annotation": ""}, "snippet": "store.comment.author.requires = IS_NOT_EMPTY()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L144_C0", "label": "store.comment.email.requires = IS_EMAIL()", "type": "assigned_variable", "loc": [144, 144], "level": 0, "parent": null, "vector": [14, 0, 0.9351, 0.0065, 0, 0.66, 0.8387, 93, 3, 0, 0, 0, 596, 10, 1], "semantic": {"name": "store.comment.email.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_EMAIL", "annotation": ""}, "snippet": "store.comment.email.requires = IS_EMAIL()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L145_C0", "label": "store.comment.body.requires = IS_NOT_EMPTY()", "type": "assigned_variable", "loc": [145, 145], "level": 0, "parent": null, "vector": [14, 0, 0.9416, 0.0065, 0, 0.66, 0.871, 146, 3, 0, 0, 0, 509, 10, 1], "semantic": {"name": "store.comment.body.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_NOT_EMPTY", "annotation": ""}, "snippet": "store.comment.body.requires = IS_NOT_EMPTY()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L146_C0", "label": "store.comment.rate.requires = IS_IN_SET()", "type": "assigned_variable", "loc": [146, 146], "level": 0, "parent": null, "vector": [14, 0, 0.9481, 0.0065, 0, 0.66, 0.9032, 42, 3, 1, 0, 0, 525, 10, 2], "semantic": {"name": "store.comment.rate.requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_IN_SET", "annotation": ""}, "snippet": "store.comment.rate.requires = IS_IN_SET(range(5, 0, -1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:For_L147_C0", "label": "for field", "type": "for", "loc": [147, 149], "level": 0, "parent": null, "vector": [6, 0, 0.961, 0.0195, 0, 0.66, 0.9355, 480, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for field in store.info.fields:\n if field[:-2] in ['fc', 'vc']:\n store.info[field].requires = IS_FLOAT_IN_RANGE(0, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:If_L148_C4", "label": "if", "type": "if", "loc": [148, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:For_L147_C0", "vector": [4, 1, 0.9643, 0.013, 1, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field[:-2] in ['fc', 'vc']:\n store.info[field].requires = IS_FLOAT_IN_RANGE(0, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L149_C8", "label": "store.info[field].requires = IS_FLOAT_IN_RANGE()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:If_L148_C4", "vector": [14, 2, 0.9675, 0.0065, 2, 0.53, 0.0, 375, 3, 2, 0, 0, 272, 10, 1], "semantic": {"name": "store.info[field].requires", "arg_names": [], "import_names": [], "rhs_call_name": "IS_FLOAT_IN_RANGE", "annotation": ""}, "snippet": " store.info[field].requires = IS_FLOAT_IN_RANGE(0, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:If_L152_C0", "label": "if", "type": "if", "loc": [152, 153], "level": 0, "parent": null, "vector": [4, 0, 0.9903, 0.013, 0, 0.66, 0.9677, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(store(store.info.id > 0).select()) == 0:\n store.info.insert(name='[store name]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L153_C4", "label": "insert()", "type": "expression", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1:If_L152_C0", "vector": [8, 1, 0.9935, 0.0065, 1, 0.79, 0.0, 368, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " store.info.insert(name='[store name]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L154_C0", "label": "mystore =", "type": "assigned_variable", "loc": [154, 154], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0065, 0, 0.66, 1.0, 452, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "mystore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mystore = store(store.info.id > 0).select()[0]"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1:For_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1:If_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1:If_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1:Expr_L153_C4"}]
# import re # delimiter to use between words in URL URL_DELIMITER = '-' def pretty_url(id, name): """Create pretty URL from record name and ID """ return '%s%s%d' % (' '.join(re.sub('[^\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id) def pretty_id(url): """Extract id from pretty URL """ return int(url.rpartition(URL_DELIMITER)[-1]) def pretty_text(s): "Make text pretty by capitalizing and using 'home' instead of 'default'" return s.replace('default', 'home').replace('_', ' ').capitalize() def title(): if response.title: return response.title elif request.function == 'index': return pretty_text(request.controller) else: return pretty_text(request.function)
ajibawa-2023/Python-Code-Large/train/row_2
17
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_2:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1071, 0.0357, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Assign_L7_C0", "label": "URL_DELIMITER =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0357, 0, 0.66, 0.2, 352, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "URL_DELIMITER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "URL_DELIMITER = '-'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L8_C0", "label": "pretty_url", "type": "function", "loc": [8, 11], "level": 0, "parent": null, "vector": [2, 0, 0.3393, 0.1429, 0, 0.66, 0.4, 879, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "pretty_url", "arg_names": ["id", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pretty_url(id, name):\n \"\"\"Create pretty URL from record name and ID\n \"\"\"\n return '%s%s%d' % (' '.join(re.sub('[^\\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L8_C0", "vector": [8, 1, 0.3393, 0.0714, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create pretty URL from record name and ID\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L8_C0", "vector": [13, 1, 0.3929, 0.0357, 1, 0.54, 1.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s%s%d' % (' '.join(re.sub('[^\\w ]+', '', name).split()).replace(' ', URL_DELIMITER), URL_DELIMITER, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L13_C0", "label": "pretty_id", "type": "function", "loc": [13, 16], "level": 0, "parent": null, "vector": [2, 0, 0.5179, 0.1429, 0, 0.66, 0.6, 102, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "pretty_id", "arg_names": ["url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pretty_id(url):\n \"\"\"Extract id from pretty URL\n \"\"\"\n return int(url.rpartition(URL_DELIMITER)[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L13_C0", "vector": [8, 1, 0.5179, 0.0714, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extract id from pretty URL\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L13_C0", "vector": [13, 1, 0.5714, 0.0357, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(url.rpartition(URL_DELIMITER)[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L18_C0", "label": "pretty_text", "type": "function", "loc": [18, 20], "level": 0, "parent": null, "vector": [2, 0, 0.6786, 0.1071, 0, 0.66, 0.8, 668, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "pretty_text", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pretty_text(s):\n \"Make text pretty by capitalizing and using 'home' instead of 'default'\"\n return s.replace('default', 'home').replace('_', ' ').capitalize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L18_C0", "vector": [8, 1, 0.6786, 0.0357, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Make text pretty by capitalizing and using 'home' instead of 'default'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L18_C0", "vector": [13, 1, 0.7143, 0.0357, 1, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s.replace('default', 'home').replace('_', ' ').capitalize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L22_C0", "label": "title", "type": "function", "loc": [22, 28], "level": 0, "parent": null, "vector": [2, 0, 0.8929, 0.25, 0, 0.66, 1.0, 48, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def title():\n if response.title:\n return response.title\n elif request.function == 'index':\n return pretty_text(request.controller)\n else:\n return pretty_text(request.function)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4", "label": "if", "type": "if", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L22_C0", "vector": [4, 1, 0.9107, 0.2143, 1, 0.98, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if response.title:\n return response.title\n elif request.function == 'index':\n return pretty_text(request.controller)\n else:\n return pretty_text(request.function)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4", "vector": [13, 2, 0.8571, 0.0357, 2, 0.37, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response.title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4", "label": "if", "type": "if", "loc": [25, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4", "vector": [4, 2, 0.9464, 0.1429, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif request.function == 'index':\n return pretty_text(request.controller)\n else:\n return pretty_text(request.function)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4", "vector": [13, 3, 0.9286, 0.0357, 3, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pretty_text(request.controller)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4", "vector": [13, 3, 1.0, 0.0357, 3, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pretty_text(request.function)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_2:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_2:Return_L28_C8"}]
########################################################### ### make sure administrator is on localhost ############################################################ import os, socket, datetime,copy import gluon.contenttype import gluon.fileutils ### crytical --- make a copy of the environment global_env=copy.copy(globals()) global_env['datetime']=datetime http_host = request.env.http_host.split(':')[0] remote_addr = request.env.remote_addr try: hosts=(http_host, socket.gethostbyname(remote_addr)) except: hosts=(http_host,) if remote_addr not in hosts: pass #raise HTTP(400) if not gluon.fileutils.check_credentials(request): redirect('/admin') response.view='appadmin.html' response.menu=[[T('design'),False,URL('admin','default','design', args=[request.application])], [T('db'),False,URL(r=request,f='index')], [T('state'),False,URL(r=request,f='state')]] ########################################################### ### auxiliary functions ############################################################ def get_databases(request): dbs={} for key,value in global_env.items(): cond=False try: cond=isinstance(value,GQLDB) except: cond=isinstance(value,SQLDB) if cond: dbs[key]=value return dbs databases=get_databases(None) def eval_in_global_env(text): exec('_ret=%s'%text,{},global_env) return global_env['_ret'] def get_database(request): if request.args and request.args[0] in databases: return eval_in_global_env(request.args[0]) else: session.flash=T('invalid request') redirect(URL(r=request,f='index')) def get_table(request): db=get_database(request) if len(request.args)>1 and request.args[1] in db.tables: return db,request.args[1] else: session.flash=T('invalid request') redirect(URL(r=request,f='index')) def get_query(request): try: return eval_in_global_env(request.vars.query) except Exception: return None ########################################################### ### list all databases and tables ############################################################ def index(): return dict(databases=databases) ########################################################### ### insert a new record ############################################################ def insert(): db,table=get_table(request) form=SQLFORM(db[table]) if form.accepts(request.vars,session): response.flash=T('new record inserted') return dict(form=form) ########################################################### ### list all records in table and insert new record ############################################################ def download(): import os db=get_database(request) filename=request.args[1] print filename ### for GAE only ### table,field=filename.split('.')[:2] if table in db.tables and field in db[table].fields: uploadfield=db[table][field].uploadfield if isinstance(uploadfield,str): from gluon.contenttype import contenttype response.headers['Content-Type']=contenttype(filename) rows=db(db[table][field]==filename).select() return rows[0][uploadfield] ### end for GAE ### path=os.path.join(request.folder,'uploads/',filename) return response.stream(open(path,'rb')) def csv(): import gluon.contenttype response.headers['Content-Type']=gluon.contenttype.contenttype('.csv') query=get_query(request) if not query: return None response.headers['Content-disposition']="attachment; filename=%s_%s.csv"%\ tuple(request.vars.query.split('.')[:2]) return str(db(query).select()) def import_csv(table,file): import csv reader = csv.reader(file) colnames=None for line in reader: if not colnames: colnames=[x[x.find('.')+1:] for x in line] c=[i for i in range(len(line)) if colnames[i]!='id'] else: items=[(colnames[i],line[i]) for i in c] table.insert(**dict(items)) def select(): import re db=get_database(request) dbname=request.args[0] regex=re.compile('(?P<table>\w+)\.(?P<field>\w+)=(?P<value>\d+)') if request.vars.query: match=regex.match(request.vars.query) if match: request.vars.query='%s.%s.%s==%s' % (request.args[0],match.group('table'),match.group('field'),match.group('value')) else: request.vars.query=session.last_query query=get_query(request) if request.vars.start: start=int(request.vars.start) else: start=0 nrows=0 stop=start+100 table=None rows=[] orderby=request.vars.orderby if orderby: orderby=dbname+'.'+orderby if orderby==session.last_orderby: if orderby[0]=='~': orderby=orderby[1:] else: orderby='~'+orderby session.last_orderby=orderby session.last_query=request.vars.query form=FORM(TABLE(TR('Query:','',INPUT(_style='width:400px',_name='query',_value=request.vars.query or '',requires=IS_NOT_EMPTY())), TR('Update:',INPUT(_name='update_check',_type='checkbox',value=False), INPUT(_style='width:400px',_name='update_fields',_value=request.vars.update_fields or '')), TR('Delete:',INPUT(_name='delete_check',_class='delete',_type='checkbox',value=False),''), TR('','',INPUT(_type='submit',_value='submit')))) if request.vars.csvfile!=None: try: import_csv(db[request.vars.table],request.vars.csvfile.file) response.flash=T('data uploaded') except: response.flash=T('unable to parse csv file') if form.accepts(request.vars,formname=None): regex=re.compile(request.args[0]+'\.(?P<table>\w+)\.id\>0') match=regex.match(form.vars.query.strip()) if match: table=match.group('table') try: nrows=db(query).count() if form.vars.update_check and form.vars.update_fields: db(query).update(**eval_in_global_env('dict(%s)'%form.vars.update_fields)) response.flash=T('%s rows updated',nrows) elif form.vars.delete_check: db(query).delete() response.flash=T('%s rows deleted',nrows) nrows=db(query).count() if orderby: rows=db(query).select(limitby=(start,stop), orderby=eval_in_global_env(orderby)) else: rows=db(query).select(limitby=(start,stop)) except: rows,nrows=[],0 response.flash=T('Invalid Query') return dict(form=form,table=table,start=start,stop=stop,nrows=nrows,rows=rows,query=request.vars.query) ########################################################### ### edit delete one record ############################################################ def update(): db,table=get_table(request) try: id=int(request.args[2]) record=db(db[table].id==id).select()[0] except: session.flash=T('record does not exist') redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2])))) form=SQLFORM(db[table],record,deletable=True, linkto=URL(r=request,f='select',args=request.args[:1]), upload=URL(r=request,f='download',args=request.args[:1])) if form.accepts(request.vars,session): response.flash=T('done!') redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2])))) return dict(form=form) ########################################################### ### get global variables ############################################################ def state(): return dict()
ajibawa-2023/Python-Code-Large/train/row_3
152
208
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L6_C0", "label": "os import os, socket, datetime\u2026", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0288, 0.0048, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "socket", "datetime", "copy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, socket, datetime,copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L7_C0", "label": "gluon.contenttype import gluon.contenttype", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0337, 0.0048, 0, 0.66, 0.04, 919, 0, 1, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["gluon.contenttype"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L8_C0", "label": "gluon.fileutils import gluon.fileutils", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0048, 0, 0.66, 0.08, 948, 0, 1, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["gluon.fileutils"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.fileutils"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L10_C0", "label": "global_env = copy()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.0481, 0.0048, 0, 0.66, 0.12, 201, 3, 1, 0, 0, 739, 10, 2], "semantic": {"name": "global_env", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "global_env=copy.copy(globals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L11_C0", "label": "assign", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0529, 0.0048, 0, 0.66, 0.16, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_env['datetime']=datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L12_C0", "label": "http_host =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0577, 0.0048, 0, 0.66, 0.2, 785, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "http_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "http_host = request.env.http_host.split(':')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L13_C0", "label": "remote_addr =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0625, 0.0048, 0, 0.66, 0.24, 351, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "remote_addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "remote_addr = request.env.remote_addr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L14_C0", "label": "try", "type": "try", "loc": [14, 15], "level": 0, "parent": null, "vector": [7, 0, 0.0697, 0.0096, 0, 0.66, 0.28, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try: hosts=(http_host, socket.gethostbyname(remote_addr))\nexcept: hosts=(http_host,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L14_C5", "label": "hosts =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L14_C0", "vector": [14, 1, 0.0673, 0.0048, 1, 0.31, 0.0, 474, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "hosts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try: hosts=(http_host, socket.gethostbyname(remote_addr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L15_C8", "label": "hosts =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L14_C0", "vector": [14, 1, 0.0721, 0.0048, 1, 0.31, 0.0, 474, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "hosts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "except: hosts=(http_host,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L16_C0", "label": "if", "type": "if", "loc": [16, 17], "level": 0, "parent": null, "vector": [4, 0, 0.0793, 0.0096, 0, 0.66, 0.32, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if remote_addr not in hosts:\n pass #raise HTTP(400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L18_C0", "label": "if", "type": "if", "loc": [18, 19], "level": 0, "parent": null, "vector": [4, 0, 0.0889, 0.0096, 0, 0.66, 0.36, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not gluon.fileutils.check_credentials(request):\n redirect('/admin')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L19_C4", "label": "redirect()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L18_C0", "vector": [8, 1, 0.0913, 0.0048, 1, 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('/admin')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L21_C0", "label": "response.view =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.101, 0.0048, 0, 0.66, 0.4, 301, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.view='appadmin.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L22_C0", "label": "response.menu =", "type": "assigned_variable", "loc": [22, 25], "level": 0, "parent": null, "vector": [14, 0, 0.113, 0.0192, 0, 0.66, 0.44, 367, 0, 0, 0, 0, 0, 5, 6], "semantic": {"name": "response.menu", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.menu=[[T('design'),False,URL('admin','default','design',\n args=[request.application])],\n [T('db'),False,URL(r=request,f='index')],\n [T('state'),False,URL(r=request,f='state')]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "label": "get_databases", "type": "function", "loc": [31, 38], "level": 0, "parent": null, "vector": [2, 0, 0.1659, 0.0385, 0, 0.66, 0.48, 971, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_databases", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_databases(request):\n dbs={}\n for key,value in global_env.items():\n cond=False\n try: cond=isinstance(value,GQLDB)\n except: cond=isinstance(value,SQLDB)\n if cond: dbs[key]=value\n return dbs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L32_C4", "label": "dbs =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "vector": [14, 1, 0.1538, 0.0048, 1, 0.82, 0.0, 931, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dbs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbs={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "label": "for key, value", "type": "for", "loc": [33, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "vector": [6, 1, 0.1683, 0.024, 1, 0.82, 0.5, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key,value in global_env.items():\n cond=False\n try: cond=isinstance(value,GQLDB)\n except: cond=isinstance(value,SQLDB)\n if cond: dbs[key]=value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L34_C8", "label": "cond =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "vector": [14, 2, 0.1635, 0.0048, 2, 0.03, 0.0, 98, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "cond", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cond=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8", "label": "try", "type": "try", "loc": [35, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "vector": [7, 2, 0.1707, 0.0096, 2, 0.03, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try: cond=isinstance(value,GQLDB)\n except: cond=isinstance(value,SQLDB)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L35_C13", "label": "cond = isinstance()", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8", "vector": [14, 3, 0.1683, 0.0048, 3, 0.31, 0.0, 98, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "cond", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " try: cond=isinstance(value,GQLDB)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L36_C16", "label": "cond = isinstance()", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8", "vector": [14, 3, 0.1731, 0.0048, 3, 0.31, 0.0, 98, 3, 2, 0, 0, 552, 10, 1], "semantic": {"name": "cond", "arg_names": [], "import_names": [], "rhs_call_name": "isinstance", "annotation": ""}, "snippet": " except: cond=isinstance(value,SQLDB)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L37_C8", "label": "if", "type": "if", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "vector": [4, 2, 0.1779, 0.0048, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cond: dbs[key]=value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L37_C17", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L37_C8", "vector": [14, 3, 0.1779, 0.0048, 3, 0.76, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cond: dbs[key]=value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L38_C4", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "vector": [13, 1, 0.1827, 0.0048, 1, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dbs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L40_C0", "label": "databases = get_databases()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.1923, 0.0048, 0, 0.66, 0.52, 95, 3, 1, 0, 0, 971, 10, 1], "semantic": {"name": "databases", "arg_names": [], "import_names": [], "rhs_call_name": "get_databases", "annotation": ""}, "snippet": "databases=get_databases(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L42_C0", "label": "eval_in_global_env", "type": "function", "loc": [42, 44], "level": 0, "parent": null, "vector": [2, 0, 0.2067, 0.0144, 0, 0.66, 0.56, 614, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "eval_in_global_env", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def eval_in_global_env(text):\n exec('_ret=%s'%text,{},global_env)\n return global_env['_ret']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L43_C4", "label": "exec()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L42_C0", "vector": [8, 1, 0.2067, 0.0048, 1, 0.05, 0.0, 272, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec('_ret=%s'%text,{},global_env)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L44_C4", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L42_C0", "vector": [13, 1, 0.2115, 0.0048, 1, 0.05, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return global_env['_ret']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L46_C0", "label": "get_database", "type": "function", "loc": [46, 51], "level": 0, "parent": null, "vector": [2, 0, 0.2332, 0.0288, 0, 0.66, 0.6, 719, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_database", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_database(request):\n if request.args and request.args[0] in databases:\n return eval_in_global_env(request.args[0])\n else:\n session.flash=T('invalid request')\n redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "label": "if", "type": "if", "loc": [47, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L46_C0", "vector": [4, 1, 0.2356, 0.024, 1, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.args and request.args[0] in databases:\n return eval_in_global_env(request.args[0])\n else:\n session.flash=T('invalid request')\n redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "vector": [13, 2, 0.2308, 0.0048, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return eval_in_global_env(request.args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L50_C8", "label": "session.flash = T()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "vector": [14, 2, 0.2404, 0.0048, 2, 0.34, 0.5, 837, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "session.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " session.flash=T('invalid request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L51_C8", "label": "redirect()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "vector": [8, 2, 0.2452, 0.0048, 2, 0.34, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L53_C0", "label": "get_table", "type": "function", "loc": [53, 59], "level": 0, "parent": null, "vector": [2, 0, 0.2692, 0.0337, 0, 0.66, 0.64, 269, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_table", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_table(request):\n db=get_database(request)\n if len(request.args)>1 and request.args[1] in db.tables:\n return db,request.args[1]\n else:\n session.flash=T('invalid request')\n redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L54_C4", "label": "db = get_database()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L53_C0", "vector": [14, 1, 0.2596, 0.0048, 1, 0.25, 0.0, 761, 3, 1, 0, 0, 719, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "get_database", "annotation": ""}, "snippet": " db=get_database(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "label": "if", "type": "if", "loc": [55, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L53_C0", "vector": [4, 1, 0.274, 0.024, 1, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(request.args)>1 and request.args[1] in db.tables:\n return db,request.args[1]\n else:\n session.flash=T('invalid request')\n redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "vector": [13, 2, 0.2692, 0.0048, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db,request.args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L58_C8", "label": "session.flash = T()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "vector": [14, 2, 0.2788, 0.0048, 2, 0.88, 0.5, 837, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "session.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " session.flash=T('invalid request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L59_C8", "label": "redirect()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "vector": [8, 2, 0.2837, 0.0048, 2, 0.88, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L61_C0", "label": "get_query", "type": "function", "loc": [61, 65], "level": 0, "parent": null, "vector": [2, 0, 0.3029, 0.024, 0, 0.66, 0.68, 709, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_query", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_query(request):\n try:\n return eval_in_global_env(request.vars.query)\n except Exception:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4", "label": "try", "type": "try", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L61_C0", "vector": [7, 1, 0.3053, 0.0192, 1, 0.46, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return eval_in_global_env(request.vars.query)\n except Exception:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4", "vector": [13, 2, 0.3029, 0.0048, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return eval_in_global_env(request.vars.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4", "vector": [13, 2, 0.3125, 0.0048, 2, 0.97, 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_3:FunctionDef_L71_C0", "label": "index", "type": "function", "loc": [71, 72], "level": 0, "parent": null, "vector": [2, 0, 0.3438, 0.0096, 0, 0.66, 0.72, 780, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index(): \n return dict(databases=databases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L72_C4", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L71_C0", "vector": [13, 1, 0.3462, 0.0048, 1, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(databases=databases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "label": "insert", "type": "function", "loc": [78, 83], "level": 0, "parent": null, "vector": [2, 0, 0.387, 0.0288, 0, 0.66, 0.76, 368, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def insert():\n db,table=get_table(request)\n form=SQLFORM(db[table])\n if form.accepts(request.vars,session):\n response.flash=T('new record inserted')\n return dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L79_C4", "label": "db, table = get_table()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "vector": [14, 1, 0.3798, 0.0048, 1, 0.05, 0.0, 506, 3, 1, 0, 0, 269, 10, 1], "semantic": {"name": "db, table", "arg_names": [], "import_names": [], "rhs_call_name": "get_table", "annotation": ""}, "snippet": " db,table=get_table(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L80_C4", "label": "form = SQLFORM()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "vector": [14, 1, 0.3846, 0.0048, 1, 0.05, 0.3333, 761, 3, 1, 0, 0, 723, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " form=SQLFORM(db[table])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L81_C4", "label": "if", "type": "if", "loc": [81, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "vector": [4, 1, 0.3918, 0.0096, 1, 0.05, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,session):\n response.flash=T('new record inserted')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L82_C8", "label": "response.flash = T()", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L81_C4", "vector": [14, 2, 0.3942, 0.0048, 2, 0.29, 0.0, 211, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('new record inserted')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L83_C4", "label": "return", "type": "return", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "vector": [13, 1, 0.399, 0.0048, 1, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "label": "download", "type": "function", "loc": [89, 105], "level": 0, "parent": null, "vector": [2, 0, 0.4663, 0.0817, 0, 0.66, 0.8, 0, 0, 0, 1, 0, 0, 0, 10], "semantic": {"name": "download", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download():\n import os\n db=get_database(request)\n filename=request.args[1]\n print(filename)\n ### for GAE only ###\n table,field=filename.split('.')[:2]\n if table in db.tables and field in db[table].fields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L90_C4", "label": "os import os", "type": "import", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [1, 1, 0.4327, 0.0048, 1, 0.74, 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_3:Assign_L91_C4", "label": "db = get_database()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [14, 1, 0.4375, 0.0048, 1, 0.74, 0.1429, 761, 3, 1, 0, 0, 719, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "get_database", "annotation": ""}, "snippet": " db=get_database(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L92_C4", "label": "filename =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [14, 1, 0.4423, 0.0048, 1, 0.74, 0.2857, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename=request.args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [8, 1, 0.4471, 0.0048, 1, 0.74, 0.4286, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L95_C4", "label": "table, field =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [14, 1, 0.4567, 0.0048, 1, 0.74, 0.5714, 554, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "table, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table,field=filename.split('.')[:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4", "label": "if", "type": "if", "loc": [96, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [4, 1, 0.476, 0.0337, 1, 0.74, 0.7143, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table in db.tables and field in db[table].fields:\n uploadfield=db[table][field].uploadfield\n if isinstance(uploadfield,str):\n from gluon.contenttype import contenttype\n response.headers['Content-Type']=contenttype(filename)\n rows=db(db[table][field]==filename).select()\n return rows[0][uploadfield]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L97_C8", "label": "uploadfield =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4", "vector": [14, 2, 0.4663, 0.0048, 2, 0.3, 0.0, 286, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "uploadfield", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " uploadfield=db[table][field].uploadfield"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "label": "if", "type": "if", "loc": [98, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4", "vector": [4, 2, 0.4808, 0.024, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(uploadfield,str):\n from gluon.contenttype import contenttype\n response.headers['Content-Type']=contenttype(filename)\n rows=db(db[table][field]==filename).select()\n return rows[0][uploadfield]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:ImportFrom_L99_C12", "label": "from gluon.contenttype import contenttype", "type": "import", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "vector": [1, 3, 0.476, 0.0048, 3, 0.6, 0.0, 919, 0, 1, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["contenttype"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.contenttype import contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L100_C12", "label": " = contenttype()", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "vector": [14, 3, 0.4808, 0.0048, 3, 0.6, 0.3333, 0, 3, 1, 0, 0, 97, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "contenttype", "annotation": ""}, "snippet": " response.headers['Content-Type']=contenttype(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L101_C12", "label": "rows = select()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "vector": [14, 3, 0.4856, 0.0048, 3, 0.6, 0.6667, 275, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " rows=db(db[table][field]==filename).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L102_C12", "label": "return", "type": "return", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "vector": [13, 3, 0.4904, 0.0048, 3, 0.6, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rows[0][uploadfield]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L104_C4", "label": "path = join()", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [14, 1, 0.5, 0.0048, 1, 0.74, 0.8571, 358, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path=os.path.join(request.folder,'uploads/',filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L105_C4", "label": "return", "type": "return", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "vector": [13, 1, 0.5048, 0.0048, 1, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response.stream(open(path,'rb'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "label": "csv", "type": "function", "loc": [107, 114], "level": 0, "parent": null, "vector": [2, 0, 0.5312, 0.0385, 0, 0.66, 0.84, 312, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "csv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def csv():\n import gluon.contenttype\n response.headers['Content-Type']=gluon.contenttype.contenttype('.csv')\n query=get_query(request)\n if not query: return None\n response.headers['Content-disposition']=\"attachment; filename=%s_%s.csv\"%\\\n tuple(request.vars.query.split('.')[:2])\n return str(db(query).select())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L108_C4", "label": "gluon.contenttype import gluon.contenttype", "type": "import", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [1, 1, 0.5192, 0.0048, 1, 0.16, 0.0, 919, 0, 1, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["gluon.contenttype"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L109_C4", "label": " = contenttype()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [14, 1, 0.524, 0.0048, 1, 0.16, 0.2, 0, 3, 1, 0, 0, 97, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "contenttype", "annotation": ""}, "snippet": " response.headers['Content-Type']=gluon.contenttype.contenttype('.csv')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L110_C4", "label": "query = get_query()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [14, 1, 0.5288, 0.0048, 1, 0.16, 0.4, 546, 3, 1, 0, 0, 709, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "get_query", "annotation": ""}, "snippet": " query=get_query(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L111_C4", "label": "if", "type": "if", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [4, 1, 0.5337, 0.0048, 1, 0.16, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not query: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L111_C18", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L111_C4", "vector": [13, 2, 0.5337, 0.0048, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not query: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L112_C4", "label": "assign", "type": "assigned_variable", "loc": [112, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [14, 1, 0.5409, 0.0096, 1, 0.16, 0.8, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.headers['Content-disposition']=\"attachment; filename=%s_%s.csv\"%\\\n tuple(request.vars.query.split('.')[:2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "vector": [13, 1, 0.5481, 0.0048, 1, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(db(query).select())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "label": "import_csv", "type": "function", "loc": [116, 126], "level": 0, "parent": null, "vector": [2, 0, 0.5817, 0.0529, 0, 0.66, 0.88, 932, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "import_csv", "arg_names": ["table", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def import_csv(table,file):\n import csv\n reader = csv.reader(file)\n colnames=None\n for line in reader:\n if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L117_C4", "label": "csv import csv", "type": "import", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "vector": [1, 1, 0.5625, 0.0048, 1, 0.8, 0.0, 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_3:Assign_L118_C4", "label": "reader = reader()", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "vector": [14, 1, 0.5673, 0.0048, 1, 0.8, 0.3333, 548, 3, 1, 0, 0, 548, 10, 1], "semantic": {"name": "reader", "arg_names": [], "import_names": [], "rhs_call_name": "reader", "annotation": ""}, "snippet": " reader = csv.reader(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L119_C4", "label": "colnames =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "vector": [14, 1, 0.5721, 0.0048, 1, 0.8, 0.6667, 849, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colnames=None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:For_L120_C4", "label": "for line", "type": "for", "loc": [120, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "vector": [6, 1, 0.5913, 0.0337, 1, 0.8, 1.0, 373, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in reader:\n if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] \n else:\n items=[(colnames[i],line[i]) for i in c]\n table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "label": "if", "type": "if", "loc": [121, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:For_L120_C4", "vector": [4, 2, 0.5938, 0.0288, 2, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] \n else:\n items=[(colnames[i],line[i]) for i in c]\n table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L122_C12", "label": "colnames =", "type": "assigned_variable", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "vector": [14, 3, 0.5865, 0.0048, 3, 0.51, 0.0, 849, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colnames=[x[x.find('.')+1:] for x in line]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L123_C12", "label": "c =", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "vector": [14, 3, 0.5913, 0.0048, 3, 0.51, 0.3333, 411, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c=[i for i in range(len(line)) if colnames[i]!='id'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L125_C12", "label": "items =", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "vector": [14, 3, 0.601, 0.0048, 3, 0.51, 0.6667, 339, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items=[(colnames[i],line[i]) for i in c]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L126_C12", "label": "insert()", "type": "expression", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "vector": [8, 3, 0.6058, 0.0048, 3, 0.51, 1.0, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "label": "select", "type": "function", "loc": [128, 182], "level": 0, "parent": null, "vector": [2, 0, 0.7452, 0.2644, 0, 0.66, 0.92, 438, 0, 0, 1, 0, 0, 0, 46], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def select():\n import re\n db=get_database(request)\n dbname=request.args[0]\n regex=re.compile('(?P<table>\\w+)\\.(?P<field>\\w+)=(?P<value>\\d+)')\n if request.vars.query:\n match=regex.match(request.vars.query)\n if match: request.vars.query='%s.%s.%s==%s' % (request.args[0],match.group('table'),match.group('field'),match.group('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L129_C4", "label": "re import re", "type": "import", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [1, 1, 0.6202, 0.0048, 1, 0.26, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": " import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L130_C4", "label": "db = get_database()", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.625, 0.0048, 1, 0.26, 0.0556, 761, 3, 1, 0, 0, 719, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "get_database", "annotation": ""}, "snippet": " db=get_database(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L131_C4", "label": "dbname =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6298, 0.0048, 1, 0.26, 0.1111, 396, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbname=request.args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L132_C4", "label": "regex = compile()", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6346, 0.0048, 1, 0.26, 0.1667, 552, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex=re.compile('(?P<table>\\w+)\\.(?P<field>\\w+)=(?P<value>\\d+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "label": "if", "type": "if", "loc": [133, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [4, 1, 0.649, 0.024, 1, 0.26, 0.2222, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.query:\n match=regex.match(request.vars.query)\n if match: request.vars.query='%s.%s.%s==%s' % (request.args[0],match.group('table'),match.group('field'),match.group('value'))\n else:\n request.vars.query=session.last_query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L134_C8", "label": "match = match()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "vector": [14, 2, 0.6442, 0.0048, 2, 0.63, 0.0, 36, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match=regex.match(request.vars.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L135_C8", "label": "if", "type": "if", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "vector": [4, 2, 0.649, 0.0048, 2, 0.63, 0.5, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match: request.vars.query='%s.%s.%s==%s' % (request.args[0],match.group('table'),match.group('field'),match.group('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L135_C18", "label": "request.vars.query =", "type": "assigned_variable", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L135_C8", "vector": [14, 3, 0.649, 0.0048, 3, 0.32, 0.0, 382, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "request.vars.query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match: request.vars.query='%s.%s.%s==%s' % (request.args[0],match.group('table'),match.group('field'),match.group('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L137_C8", "label": "request.vars.query =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "vector": [14, 2, 0.6587, 0.0048, 2, 0.63, 1.0, 382, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request.vars.query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.vars.query=session.last_query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L138_C4", "label": "query = get_query()", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6635, 0.0048, 1, 0.26, 0.2778, 546, 3, 1, 0, 0, 709, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "get_query", "annotation": ""}, "snippet": " query=get_query(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4", "label": "if", "type": "if", "loc": [139, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [4, 1, 0.6707, 0.0096, 1, 0.26, 0.3333, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.start: start=int(request.vars.start)\n else: start=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L139_C27", "label": "start = int()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4", "vector": [14, 2, 0.6683, 0.0048, 2, 0.91, 0.0, 511, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " if request.vars.start: start=int(request.vars.start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L140_C10", "label": "start =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4", "vector": [14, 2, 0.6731, 0.0048, 2, 0.91, 1.0, 511, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: start=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L141_C4", "label": "nrows =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6779, 0.0048, 1, 0.26, 0.3889, 61, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "nrows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nrows=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L142_C4", "label": "stop =", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6827, 0.0048, 1, 0.26, 0.4444, 343, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stop=start+100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L143_C4", "label": "table =", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6875, 0.0048, 1, 0.26, 0.5, 338, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table=None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L144_C4", "label": "rows =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6923, 0.0048, 1, 0.26, 0.5556, 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_3:Assign_L145_C4", "label": "orderby =", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.6971, 0.0048, 1, 0.26, 0.6111, 518, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orderby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orderby=request.vars.orderby"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4", "label": "if", "type": "if", "loc": [146, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [4, 1, 0.7115, 0.024, 1, 0.26, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderby:\n orderby=dbname+'.'+orderby\n if orderby==session.last_orderby:\n if orderby[0]=='~': orderby=orderby[1:]\n else: orderby='~'+orderby "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L147_C8", "label": "orderby =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4", "vector": [14, 2, 0.7067, 0.0048, 2, 0.6, 0.0, 518, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orderby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " orderby=dbname+'.'+orderby"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L148_C8", "label": "if", "type": "if", "loc": [148, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4", "vector": [4, 2, 0.7163, 0.0144, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderby==session.last_orderby:\n if orderby[0]=='~': orderby=orderby[1:]\n else: orderby='~'+orderby "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11", "label": "if", "type": "if", "loc": [149, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L148_C8", "vector": [4, 3, 0.7188, 0.0096, 3, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderby[0]=='~': orderby=orderby[1:]\n else: orderby='~'+orderby "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L149_C31", "label": "orderby =", "type": "assigned_variable", "loc": [149, 149], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11", "vector": [14, 4, 0.7163, 0.0048, 4, 0.23, 0.0, 518, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orderby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderby[0]=='~': orderby=orderby[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L150_C17", "label": "orderby =", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11", "vector": [14, 4, 0.7212, 0.0048, 4, 0.23, 1.0, 518, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "orderby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: orderby='~'+orderby "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L151_C4", "label": "session.last_orderby =", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.726, 0.0048, 1, 0.26, 0.7222, 672, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "session.last_orderby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.last_orderby=orderby"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L152_C4", "label": "session.last_query =", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.7308, 0.0048, 1, 0.26, 0.7778, 176, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "session.last_query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.last_query=request.vars.query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L153_C4", "label": "form = FORM()", "type": "assigned_variable", "loc": [153, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [14, 1, 0.7452, 0.024, 1, 0.26, 0.8333, 761, 3, 1, 0, 0, 690, 10, 12], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "FORM", "annotation": ""}, "snippet": " form=FORM(TABLE(TR('Query:','',INPUT(_style='width:400px',_name='query',_value=request.vars.query or '',requires=IS_NOT_EMPTY())),\n TR('Update:',INPUT(_name='update_check',_type='checkbox',value=False),\n INPUT(_style='width:400px',_name='update_fields',_value=request.vars.update_fields or '')),\n TR('Delete:',INPUT(_name='delete_check',_class='delete',_type='checkbox',value=False),''),\n TR('','',INPUT(_type='submit',_value='submit'))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L158_C4", "label": "if", "type": "if", "loc": [158, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [4, 1, 0.7716, 0.0288, 1, 0.26, 0.8889, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.csvfile!=None: \n try:\n import_csv(db[request.vars.table],request.vars.csvfile.file)\n response.flash=T('data uploaded')\n except: \n response.flash=T('unable to parse csv file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "label": "try", "type": "try", "loc": [159, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L158_C4", "vector": [7, 2, 0.774, 0.024, 2, 0.29, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import_csv(db[request.vars.table],request.vars.csvfile.file)\n response.flash=T('data uploaded')\n except: \n response.flash=T('unable to parse csv file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L160_C12", "label": "import_csv()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "vector": [8, 3, 0.7692, 0.0048, 3, 0.28, 0.0, 932, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_csv", "arg_names": [], "import_names": [], "rhs_call_name": "import_csv", "annotation": ""}, "snippet": " import_csv(db[request.vars.table],request.vars.csvfile.file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L161_C12", "label": "response.flash = T()", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "vector": [14, 3, 0.774, 0.0048, 3, 0.28, 1.0, 211, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('data uploaded')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L163_C12", "label": "response.flash = T()", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "vector": [14, 3, 0.7837, 0.0048, 3, 0.28, 0.0, 211, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('unable to parse csv file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "label": "if", "type": "if", "loc": [164, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [4, 1, 0.8293, 0.0865, 1, 0.26, 0.9444, 0, 3, 0, 0, 0, 0, 0, 22], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,formname=None):\n regex=re.compile(request.args[0]+'\\.(?P<table>\\w+)\\.id\\>0')\n match=regex.match(form.vars.query.strip())\n if match: table=match.group('table')\n try:\n nrows=db(query).count()\n if form.vars.update_check and form.vars.update_fields:\n db(query).update(**eval_in_global_env('dict(%s)'%form.vars.update_fields))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L165_C8", "label": "regex = compile()", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "vector": [14, 2, 0.7933, 0.0048, 2, 0.58, 0.0, 552, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex=re.compile(request.args[0]+'\\.(?P<table>\\w+)\\.id\\>0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L166_C8", "label": "match = match()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "vector": [14, 2, 0.7981, 0.0048, 2, 0.58, 0.3333, 36, 3, 1, 0, 0, 36, 10, 2], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match=regex.match(form.vars.query.strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L167_C8", "label": "if", "type": "if", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "vector": [4, 2, 0.8029, 0.0048, 2, 0.58, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match: table=match.group('table')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L167_C18", "label": "table = group()", "type": "assigned_variable", "loc": [167, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L167_C8", "vector": [14, 3, 0.8029, 0.0048, 3, 0.08, 0.0, 338, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " if match: table=match.group('table')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "label": "try", "type": "try", "loc": [168, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "vector": [7, 2, 0.8389, 0.0673, 2, 0.58, 1.0, 0, 0, 1, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nrows=db(query).count()\n if form.vars.update_check and form.vars.update_fields:\n db(query).update(**eval_in_global_env('dict(%s)'%form.vars.update_fields))\n response.flash=T('%s rows updated',nrows)\n elif form.vars.delete_check:\n db(query).delete()\n response.flash=T('%s rows deleted',nrows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L169_C12", "label": "nrows = count()", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [14, 3, 0.8125, 0.0048, 3, 0.2, 0.0, 61, 3, 0, 0, 0, 778, 10, 2], "semantic": {"name": "nrows", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " nrows=db(query).count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "label": "if", "type": "if", "loc": [170, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [4, 3, 0.8293, 0.0288, 3, 0.2, 0.3333, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.vars.update_check and form.vars.update_fields:\n db(query).update(**eval_in_global_env('dict(%s)'%form.vars.update_fields))\n response.flash=T('%s rows updated',nrows)\n elif form.vars.delete_check:\n db(query).delete()\n response.flash=T('%s rows deleted',nrows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L171_C16", "label": "update()", "type": "expression", "loc": [171, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "vector": [8, 4, 0.8221, 0.0048, 4, 0.73, 0.0, 637, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " db(query).update(**eval_in_global_env('dict(%s)'%form.vars.update_fields))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L172_C16", "label": "response.flash = T()", "type": "assigned_variable", "loc": [172, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "vector": [14, 4, 0.8269, 0.0048, 4, 0.73, 0.5, 211, 3, 2, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('%s rows updated',nrows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12", "label": "if", "type": "if", "loc": [173, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "vector": [4, 4, 0.8365, 0.0144, 4, 0.73, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif form.vars.delete_check:\n db(query).delete()\n response.flash=T('%s rows deleted',nrows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L174_C16", "label": "delete()", "type": "expression", "loc": [174, 174], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12", "vector": [8, 5, 0.8365, 0.0048, 5, 0.97, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db(query).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L175_C16", "label": "response.flash = T()", "type": "assigned_variable", "loc": [175, 175], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12", "vector": [14, 5, 0.8413, 0.0048, 5, 0.97, 1.0, 211, 3, 2, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('%s rows deleted',nrows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L176_C12", "label": "nrows = count()", "type": "assigned_variable", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [14, 3, 0.8462, 0.0048, 3, 0.2, 0.6667, 61, 3, 0, 0, 0, 778, 10, 2], "semantic": {"name": "nrows", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " nrows=db(query).count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12", "label": "if", "type": "if", "loc": [177, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [4, 3, 0.8534, 0.0096, 3, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderby: rows=db(query).select(limitby=(start,stop), orderby=eval_in_global_env(orderby))\n else: rows=db(query).select(limitby=(start,stop))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L177_C24", "label": "rows = select()", "type": "assigned_variable", "loc": [177, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12", "vector": [14, 4, 0.851, 0.0048, 4, 0.23, 0.0, 275, 3, 2, 0, 0, 438, 10, 3], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " if orderby: rows=db(query).select(limitby=(start,stop), orderby=eval_in_global_env(orderby))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L178_C18", "label": "rows = select()", "type": "assigned_variable", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12", "vector": [14, 4, 0.8558, 0.0048, 4, 0.23, 1.0, 275, 3, 1, 0, 0, 438, 10, 2], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " else: rows=db(query).select(limitby=(start,stop))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L180_C12", "label": "rows, nrows =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [14, 3, 0.8654, 0.0048, 3, 0.2, 0.0, 292, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "rows, nrows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows,nrows=[],0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L181_C12", "label": "response.flash = T()", "type": "assigned_variable", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "vector": [14, 3, 0.8702, 0.0048, 3, 0.2, 1.0, 211, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('Invalid Query')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "vector": [13, 1, 0.875, 0.0048, 1, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=form,table=table,start=start,stop=stop,nrows=nrows,rows=rows,query=request.vars.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "label": "update", "type": "function", "loc": [188, 202], "level": 0, "parent": null, "vector": [2, 0, 0.9375, 0.0721, 0, 0.66, 0.96, 637, 0, 0, 1, 0, 0, 0, 19], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update():\n db,table=get_table(request)\n try:\n id=int(request.args[2])\n record=db(db[table].id==id).select()[0]\n except:\n session.flash=T('record does not exist')\n redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L189_C4", "label": "db, table = get_table()", "type": "assigned_variable", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "vector": [14, 1, 0.9087, 0.0048, 1, 0.03, 0.0, 506, 3, 1, 0, 0, 269, 10, 1], "semantic": {"name": "db, table", "arg_names": [], "import_names": [], "rhs_call_name": "get_table", "annotation": ""}, "snippet": " db,table=get_table(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "label": "try", "type": "try", "loc": [190, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "vector": [7, 1, 0.9255, 0.0288, 1, 0.03, 0.25, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n id=int(request.args[2])\n record=db(db[table].id==id).select()[0]\n except:\n session.flash=T('record does not exist')\n redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L191_C8", "label": "id = int()", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "vector": [14, 2, 0.9183, 0.0048, 2, 0.62, 0.0, 941, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " id=int(request.args[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L192_C8", "label": "record =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "vector": [14, 2, 0.9231, 0.0048, 2, 0.62, 1.0, 667, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " record=db(db[table].id==id).select()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L194_C8", "label": "session.flash = T()", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "vector": [14, 2, 0.9327, 0.0048, 2, 0.62, 0.0, 837, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "session.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " session.flash=T('record does not exist')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L195_C8", "label": "redirect()", "type": "expression", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "vector": [8, 2, 0.9375, 0.0048, 2, 0.62, 1.0, 206, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L196_C4", "label": "form = SQLFORM()", "type": "assigned_variable", "loc": [196, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "vector": [14, 1, 0.9471, 0.0144, 1, 0.03, 0.5, 761, 3, 5, 0, 0, 723, 10, 3], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " form=SQLFORM(db[table],record,deletable=True,\n linkto=URL(r=request,f='select',args=request.args[:1]),\n upload=URL(r=request,f='download',args=request.args[:1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4", "label": "if", "type": "if", "loc": [199, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "vector": [4, 1, 0.9615, 0.0144, 1, 0.03, 0.75, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,session): \n response.flash=T('done!')\n redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L200_C8", "label": "response.flash = T()", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4", "vector": [14, 2, 0.9615, 0.0048, 2, 0.74, 0.0, 211, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "T", "annotation": ""}, "snippet": " response.flash=T('done!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L201_C8", "label": "redirect()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4", "vector": [8, 2, 0.9663, 0.0048, 2, 0.74, 1.0, 206, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='select',args=request.args[:1],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L202_C4", "label": "return", "type": "return", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "vector": [13, 1, 0.9712, 0.0048, 1, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L208_C0", "label": "state", "type": "function", "loc": [208, 208], "level": 0, "parent": null, "vector": [2, 0, 1.0, 0.0048, 0, 0.66, 1.0, 688, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def state(): return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L208_C13", "label": "return", "type": "return", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L208_C0", "vector": [13, 1, 1.0, 0.0048, 1, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def state(): return dict()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L14_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L35_C13"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L37_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:ImportFrom_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L111_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:For_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:For_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Import_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L135_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L139_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L140_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L149_C31"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L149_C11", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L150_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L167_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L171_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L170_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L174_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L175_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L177_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L177_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L178_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:Try_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_3:FunctionDef_L208_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_3:Return_L208_C13"}]
if not session.cart: # instantiate new cart session.cart, session.balance = [], 0 session.google_merchant_id = mystore.google_merchant_id response.menu = [ ['Store Front', request.function == 'index', URL(r=request, f='index')], ['About Us', request.function == 'aboutus', URL(r=request, f='aboutus')], ['Contact Us', request.function == 'contactus', URL(r=request, f='contactus')], ['Shopping Cart $%.2f' % float(session.balance), request.function == 'checkout', URL(r=request, f='checkout')] ] def index(): categories = store().select(store.category.ALL, orderby=store.category.name) featured = store(store.product.featured == True).select() return dict(categories=categories,featured=featured) def category(): if not request.args: redirect(URL(r=request, f='index')) category_id = pretty_id(request.args[0]) if len(request.args) == 3: # pagination start, stop = int(request.args[1]), int(request.args[2]) else: start, stop = 0, 20 categories = store().select(store.category.ALL, orderby=store.category.name) category_name = None for category in categories: if category.id == category_id: response.title = category_name = category.name if not category_name: redirect(URL(r=request, f='index')) if start == 0: featured = store(store.product.featured == True)(store.product.category == category_id).select() else: featured = [] ids = [p.id for p in featured] favourites = store(store.product.category == category_id).select(limitby=(start, stop)) favourites = [f for f in favourites if f.id not in ids] return dict(category_name=category_name, categories=categories, featured=featured, favourites=favourites) def product(): if not request.args: redirect(URL(r=request, f='index')) product_id = pretty_id(request.args[0]) products = store(store.product.id == product_id).select() if not products: redirect(URL(r=request, f='index')) product = products[0] response.title = product.name product.update_record(viewed=product.viewed+1) options = store(store.option.product == product.id).select() product_form = FORM( TABLE( [TR(TD(INPUT(_name='option', _value=option.id, _type='checkbox', _onchange="update_price(this, %.2f)" % option.price), option.description), H3('$%.2f' % option.price)) for option in options], TR( 'Price:', H2('$%.2f' % float(product.price), _id='total_price') ), BR(), TH('Qty:', INPUT(_name='quantity', _class='integer', _value=1, _size=1)), INPUT(_type='submit', _value='Add to cart'), ) ) if product_form.accepts(request.vars, session): quantity = int(product_form.vars.quantity) option_ids = product_form.vars.option if not isinstance(option_ids, list): option_ids = [option_ids] if option_ids else [] option_ids = [int(o) for o in option_ids] product.update_record(clicked=product.clicked+1) session.cart.append((product_id, quantity, option_ids)) redirect(URL(r=request, f='checkout')) # post a comment about a product comment_form = SQLFORM(store.comment, fields=['author', 'email', 'body', 'rate']) comment_form.vars.product = product.id if comment_form.accepts(request.vars, session): nc = store(store.comment.product == product.id).count() t = products[0].rating*nc + int(comment_form.vars.rate) products[0].update_record(rating=t/(nc+1)) response.flash = 'comment posted' if comment_form.errors: response.flash = 'invalid comment' comments = store(store.comment.product == product.id).select() better_ids = [row.better for row in store(store.up_sell.product == product.id).select(store.up_sell.better)] related_ids = [row.p2 for row in store(store.cross_sell.p1 == product.id).select()] + [row.p1 for row in store(store.cross_sell.p2 == product.id).select()] suggested = [store.product[id] for id in better_ids + related_ids] # XXXstore(store.product.id.belongs(better_ids + related_ids)).select() return dict(product=product, comments=comments, options=options, suggested=suggested, product_form=product_form, comment_form=comment_form) """ {{ if product.old_price: }} <b>was ${{= '%.2f' % float(product.old_price) }}</b> {{ pass }} </form> """ def remove_from_cart(): # remove product from cart del session.cart[int(request.args[0])] redirect(URL(r=request, f='checkout')) def empty_cart(): # empty cart of all products session.cart.clear() session.balance = 0 redirect(URL(r=request, f='checkout')) def checkout(): order = [] balance = 0 for product_id, qty, option_ids in session.cart: products = store(store.product.id == product_id).select() if products: product = products[0] options = [store.option[id] for id in option_ids]# XXX store(store.option.id.belongs(option_ids)).select() if option_ids else [] total_price = qty * (product.price + sum([option.price for option in options])) order.append((product_id, qty, total_price, product, options)) balance += total_price else: # invalid product pass session.balance = balance # XXX is updating in time? return dict(order=order, merchant_id=session.google_merchant_id) def popup(): return dict() def show(): response.session_id = None import gluon.contenttype, os filename = '/'.join(request.args) response.headers['Content-Type'] = gluon.contenttype.contenttype(filename) # XXX is this path going to be a problem on Windows? return open(os.path.join(request.folder, 'uploads', filename), 'rb').read() def aboutus(): return dict() def contactus(): return dict()
ajibawa-2023/Python-Code-Large/train/row_4
95
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_4:If_L2_C0", "label": "if", "type": "if", "loc": [2, 4], "level": 0, "parent": null, "vector": [4, 0, 0.0203, 0.0203, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not session.cart:\n # instantiate new cart\n session.cart, session.balance = [], 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L4_C4", "label": "assign", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L2_C0", "vector": [14, 1, 0.027, 0.0068, 1, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.cart, session.balance = [], 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L5_C0", "label": "session.google_merchant_id =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.0338, 0.0068, 0, 0.66, 0.0769, 875, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "session.google_merchant_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "session.google_merchant_id = mystore.google_merchant_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L8_C0", "label": "response.menu =", "type": "assigned_variable", "loc": [8, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0709, 0.0405, 0, 0.66, 0.1538, 367, 0, 0, 0, 0, 0, 5, 5], "semantic": {"name": "response.menu", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.menu = [\n ['Store Front', request.function == 'index', URL(r=request, f='index')],\n ['About Us', request.function == 'aboutus', URL(r=request, f='aboutus')],\n ['Contact Us', request.function == 'contactus', URL(r=request, f='contactus')],\n ['Shopping Cart $%.2f' % float(session.balance), request.function == 'checkout', URL(r=request, f='checkout')]\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "label": "index", "type": "function", "loc": [17, 20], "level": 0, "parent": null, "vector": [2, 0, 0.125, 0.027, 0, 0.66, 0.2308, 780, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index():\n categories = store().select(store.category.ALL, orderby=store.category.name)\n featured = store(store.product.featured == True).select()\n return dict(categories=categories,featured=featured)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L18_C4", "label": "categories = select()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "vector": [14, 1, 0.1216, 0.0068, 1, 0.62, 0.0, 662, 3, 2, 0, 0, 438, 10, 2], "semantic": {"name": "categories", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " categories = store().select(store.category.ALL, orderby=store.category.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L19_C4", "label": "featured = select()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "vector": [14, 1, 0.1284, 0.0068, 1, 0.62, 0.5, 980, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "featured", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " featured = store(store.product.featured == True).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "vector": [13, 1, 0.1351, 0.0068, 1, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(categories=categories,featured=featured)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "label": "category", "type": "function", "loc": [22, 43], "level": 0, "parent": null, "vector": [2, 0, 0.2196, 0.1486, 0, 0.66, 0.3077, 74, 0, 0, 1, 0, 0, 0, 16], "semantic": {"name": "category", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def category():\n if not request.args: redirect(URL(r=request, f='index'))\n category_id = pretty_id(request.args[0])\n if len(request.args) == 3:\n # pagination\n start, stop = int(request.args[1]), int(request.args[2])\n else:\n start, stop = 0, 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L23_C4", "label": "if", "type": "if", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [4, 1, 0.1554, 0.0068, 1, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not request.args: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L23_C25", "label": "redirect()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L23_C4", "vector": [8, 2, 0.1554, 0.0068, 2, 0.74, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " if not request.args: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L24_C4", "label": "category_id = pretty_id()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.1622, 0.0068, 1, 0.28, 0.0909, 284, 3, 1, 0, 0, 102, 10, 1], "semantic": {"name": "category_id", "arg_names": [], "import_names": [], "rhs_call_name": "pretty_id", "annotation": ""}, "snippet": " category_id = pretty_id(request.args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4", "label": "if", "type": "if", "loc": [25, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [4, 1, 0.1824, 0.0338, 1, 0.28, 0.1818, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(request.args) == 3:\n # pagination\n start, stop = int(request.args[1]), int(request.args[2])\n else:\n start, stop = 0, 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L27_C8", "label": "start, stop =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4", "vector": [14, 2, 0.1824, 0.0068, 2, 0.36, 0.0, 576, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "start, stop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start, stop = int(request.args[1]), int(request.args[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L29_C8", "label": "start, stop =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4", "vector": [14, 2, 0.1959, 0.0068, 2, 0.36, 1.0, 576, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "start, stop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start, stop = 0, 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L30_C4", "label": "categories = select()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.2027, 0.0068, 1, 0.28, 0.2727, 662, 3, 2, 0, 0, 438, 10, 2], "semantic": {"name": "categories", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " categories = store().select(store.category.ALL, orderby=store.category.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L31_C4", "label": "category_name =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.2095, 0.0068, 1, 0.28, 0.3636, 193, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "category_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " category_name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:For_L32_C4", "label": "for category", "type": "for", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [6, 1, 0.223, 0.0203, 1, 0.28, 0.4545, 74, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "category", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for category in categories: \n if category.id == category_id:\n response.title = category_name = category.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L33_C8", "label": "if", "type": "if", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:For_L32_C4", "vector": [4, 2, 0.2264, 0.0135, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if category.id == category_id:\n response.title = category_name = category.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L34_C12", "label": "response.title =", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L33_C8", "vector": [14, 3, 0.2297, 0.0068, 3, 0.25, 0.0, 547, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.title = category_name = category.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L35_C4", "label": "if", "type": "if", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [4, 1, 0.2365, 0.0068, 1, 0.28, 0.5455, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not category_name: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L35_C26", "label": "redirect()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L35_C4", "vector": [8, 2, 0.2365, 0.0068, 2, 0.47, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " if not category_name: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4", "label": "if", "type": "if", "loc": [36, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [4, 1, 0.2534, 0.027, 1, 0.28, 0.6364, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start == 0:\n featured = store(store.product.featured == True)(store.product.category == category_id).select()\n else:\n featured = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L37_C8", "label": "featured = select()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4", "vector": [14, 2, 0.25, 0.0068, 2, 0.98, 0.0, 980, 3, 0, 0, 0, 438, 10, 3], "semantic": {"name": "featured", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " featured = store(store.product.featured == True)(store.product.category == category_id).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L39_C8", "label": "featured =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4", "vector": [14, 2, 0.2635, 0.0068, 2, 0.98, 1.0, 980, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "featured", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " featured = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L40_C4", "label": "ids =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.2703, 0.0068, 1, 0.28, 0.7273, 202, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ids = [p.id for p in featured]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L41_C4", "label": "favourites = select()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.277, 0.0068, 1, 0.28, 0.8182, 972, 3, 1, 0, 0, 438, 10, 2], "semantic": {"name": "favourites", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " favourites = store(store.product.category == category_id).select(limitby=(start, stop))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L42_C4", "label": "favourites =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [14, 1, 0.2838, 0.0068, 1, 0.28, 0.9091, 972, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "favourites", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " favourites = [f for f in favourites if f.id not in ids] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "vector": [13, 1, 0.2905, 0.0068, 1, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(category_name=category_name, categories=categories, featured=featured, favourites=favourites)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "label": "product", "type": "function", "loc": [45, 92], "level": 0, "parent": null, "vector": [2, 0, 0.4628, 0.3243, 0, 0.66, 0.3846, 196, 0, 0, 1, 0, 0, 0, 46], "semantic": {"name": "product", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def product():\n if not request.args: redirect(URL(r=request, f='index'))\n product_id = pretty_id(request.args[0])\n products = store(store.product.id == product_id).select()\n if not products: redirect(URL(r=request, f='index'))\n product = products[0]\n response.title = product.name\n product.update_record(viewed=product.viewed+1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L46_C4", "label": "if", "type": "if", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [4, 1, 0.3108, 0.0068, 1, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not request.args: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L46_C25", "label": "redirect()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L46_C4", "vector": [8, 2, 0.3108, 0.0068, 2, 0.59, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " if not request.args: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L47_C4", "label": "product_id = pretty_id()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.3176, 0.0068, 1, 0.1, 0.0556, 665, 3, 1, 0, 0, 102, 10, 1], "semantic": {"name": "product_id", "arg_names": [], "import_names": [], "rhs_call_name": "pretty_id", "annotation": ""}, "snippet": " product_id = pretty_id(request.args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L48_C4", "label": "products = select()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.3243, 0.0068, 1, 0.1, 0.1111, 789, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "products", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " products = store(store.product.id == product_id).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L49_C4", "label": "if", "type": "if", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [4, 1, 0.3311, 0.0068, 1, 0.1, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not products: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L49_C21", "label": "redirect()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L49_C4", "vector": [8, 2, 0.3311, 0.0068, 2, 0.16, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " if not products: redirect(URL(r=request, f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L50_C4", "label": "product =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.3378, 0.0068, 1, 0.1, 0.2222, 196, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "product", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " product = products[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L51_C4", "label": "response.title =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.3446, 0.0068, 1, 0.1, 0.2778, 547, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.title = product.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L52_C4", "label": "update_record()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [8, 1, 0.3514, 0.0068, 1, 0.1, 0.3333, 720, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_record", "arg_names": [], "import_names": [], "rhs_call_name": "update_record", "annotation": ""}, "snippet": " product.update_record(viewed=product.viewed+1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L54_C4", "label": "options = select()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.3649, 0.0068, 1, 0.1, 0.3889, 707, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " options = store(store.option.product == product.id).select() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L55_C4", "label": "product_form = FORM()", "type": "assigned_variable", "loc": [55, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.4054, 0.0743, 1, 0.1, 0.4444, 122, 3, 1, 0, 0, 690, 10, 13], "semantic": {"name": "product_form", "arg_names": [], "import_names": [], "rhs_call_name": "FORM", "annotation": ""}, "snippet": " product_form = FORM(\n TABLE(\n [TR(TD(INPUT(_name='option', _value=option.id, _type='checkbox', _onchange=\"update_price(this, %.2f)\" % option.price), option.description), H3('$%.2f' % option.price)) for option in options], \n TR(\n 'Price:',\n H2('$%.2f' % float(product.price), _id='total_price')\n ),\n BR(),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "label": "if", "type": "if", "loc": [66, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [4, 1, 0.4764, 0.0676, 1, 0.1, 0.5, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if product_form.accepts(request.vars, session): \n quantity = int(product_form.vars.quantity)\n option_ids = product_form.vars.option\n if not isinstance(option_ids, list):\n option_ids = [option_ids] if option_ids else []\n option_ids = [int(o) for o in option_ids]\n \n product.update_record(clicked=product.clicked+1) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L67_C8", "label": "quantity = int()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [14, 2, 0.4527, 0.0068, 2, 0.0, 0.0, 488, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "quantity", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " quantity = int(product_form.vars.quantity)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L68_C8", "label": "option_ids =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [14, 2, 0.4595, 0.0068, 2, 0.0, 0.1667, 190, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option_ids = product_form.vars.option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L69_C8", "label": "if", "type": "if", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [4, 2, 0.4696, 0.0135, 2, 0.0, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(option_ids, list):\n option_ids = [option_ids] if option_ids else []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L70_C12", "label": "option_ids =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L69_C8", "vector": [14, 3, 0.473, 0.0068, 3, 0.53, 0.0, 190, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option_ids = [option_ids] if option_ids else []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L71_C8", "label": "option_ids =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [14, 2, 0.4797, 0.0068, 2, 0.0, 0.5, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "option_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option_ids = [int(o) for o in option_ids]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L73_C8", "label": "update_record()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [8, 2, 0.4932, 0.0068, 2, 0.0, 0.6667, 720, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_record", "arg_names": [], "import_names": [], "rhs_call_name": "update_record", "annotation": ""}, "snippet": " product.update_record(clicked=product.clicked+1) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L74_C8", "label": "append()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [8, 2, 0.5, 0.0068, 2, 0.0, 0.8333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " session.cart.append((product_id, quantity, option_ids))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L75_C8", "label": "redirect()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "vector": [8, 2, 0.5068, 0.0068, 2, 0.0, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request, f='checkout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L79_C4", "label": "comment_form = SQLFORM()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.5338, 0.0068, 1, 0.1, 0.5556, 610, 3, 2, 0, 0, 723, 10, 1], "semantic": {"name": "comment_form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " comment_form = SQLFORM(store.comment, fields=['author', 'email', 'body', 'rate'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L80_C4", "label": "comment_form.vars.product =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.5405, 0.0068, 1, 0.1, 0.6111, 885, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "comment_form.vars.product", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comment_form.vars.product = product.id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "label": "if", "type": "if", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [4, 1, 0.5608, 0.0338, 1, 0.1, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment_form.accepts(request.vars, session):\n nc = store(store.comment.product == product.id).count()\n t = products[0].rating*nc + int(comment_form.vars.rate)\n products[0].update_record(rating=t/(nc+1))\n response.flash = 'comment posted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L82_C8", "label": "nc = count()", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "vector": [14, 2, 0.5541, 0.0068, 2, 0.97, 0.0, 692, 3, 0, 0, 0, 778, 10, 2], "semantic": {"name": "nc", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " nc = store(store.comment.product == product.id).count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L83_C8", "label": "t =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "vector": [14, 2, 0.5608, 0.0068, 2, 0.97, 0.3333, 15, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = products[0].rating*nc + int(comment_form.vars.rate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L84_C8", "label": "update_record()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "vector": [8, 2, 0.5676, 0.0068, 2, 0.97, 0.6667, 720, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_record", "arg_names": [], "import_names": [], "rhs_call_name": "update_record", "annotation": ""}, "snippet": " products[0].update_record(rating=t/(nc+1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L85_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "vector": [14, 2, 0.5743, 0.0068, 2, 0.97, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash = 'comment posted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L86_C4", "label": "if", "type": "if", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [4, 1, 0.5811, 0.0068, 1, 0.1, 0.7222, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment_form.errors: response.flash = 'invalid comment'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L86_C28", "label": "response.flash =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L86_C4", "vector": [14, 2, 0.5811, 0.0068, 2, 0.0, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment_form.errors: response.flash = 'invalid comment'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L87_C4", "label": "comments = select()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.5878, 0.0068, 1, 0.1, 0.7778, 122, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " comments = store(store.comment.product == product.id).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L89_C4", "label": "better_ids =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.6014, 0.0068, 1, 0.1, 0.8333, 47, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "better_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " better_ids = [row.better for row in store(store.up_sell.product == product.id).select(store.up_sell.better)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L90_C4", "label": "related_ids =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.6081, 0.0068, 1, 0.1, 0.8889, 509, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "related_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " related_ids = [row.p2 for row in store(store.cross_sell.p1 == product.id).select()] + [row.p1 for row in store(store.cross_sell.p2 == product.id).select()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L91_C4", "label": "suggested =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [14, 1, 0.6149, 0.0068, 1, 0.1, 0.9444, 763, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "suggested", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suggested = [store.product[id] for id in better_ids + related_ids] # XXXstore(store.product.id.belongs(better_ids + related_ids)).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L92_C4", "label": "return", "type": "return", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "vector": [13, 1, 0.6216, 0.0068, 1, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(product=product, comments=comments, options=options, suggested=suggested, product_form=product_form, comment_form=comment_form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L96_C0", "label": "expression", "type": "expression", "loc": [96, 104], "level": 0, "parent": null, "vector": [8, 0, 0.6757, 0.0608, 0, 0.66, 0.4615, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n\n\n{{ if product.old_price: }}\n<b>was ${{= '%.2f' % float(product.old_price) }}</b>\n{{ pass }}\n</form>\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L106_C0", "label": "remove_from_cart", "type": "function", "loc": [106, 109], "level": 0, "parent": null, "vector": [2, 0, 0.7264, 0.027, 0, 0.66, 0.5385, 835, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "remove_from_cart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_from_cart():\n # remove product from cart\n del session.cart[int(request.args[0])]\n redirect(URL(r=request, f='checkout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L109_C4", "label": "redirect()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L106_C0", "vector": [8, 1, 0.7365, 0.0068, 1, 0.94, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request, f='checkout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "label": "empty_cart", "type": "function", "loc": [111, 115], "level": 0, "parent": null, "vector": [2, 0, 0.7635, 0.0338, 0, 0.66, 0.6154, 48, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "empty_cart", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def empty_cart():\n # empty cart of all products\n session.cart.clear()\n session.balance = 0\n redirect(URL(r=request, f='checkout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L113_C4", "label": "clear()", "type": "expression", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "vector": [8, 1, 0.7635, 0.0068, 1, 0.56, 0.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " session.cart.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L114_C4", "label": "session.balance =", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "vector": [14, 1, 0.7703, 0.0068, 1, 0.56, 0.5, 902, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "session.balance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.balance = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L115_C4", "label": "redirect()", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "vector": [8, 1, 0.777, 0.0068, 1, 0.56, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request, f='checkout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "label": "checkout", "type": "function", "loc": [118, 133], "level": 0, "parent": null, "vector": [2, 0, 0.848, 0.1081, 0, 0.66, 0.6923, 33, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "checkout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def checkout():\n order = []\n balance = 0\n for product_id, qty, option_ids in session.cart:\n products = store(store.product.id == product_id).select()\n if products:\n product = products[0]\n options = [store.option[id] for id in option_ids]# XXX store(store.option.id.belongs(option_ids)).select() if option_ids else []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L119_C4", "label": "order =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "vector": [14, 1, 0.8041, 0.0068, 1, 0.94, 0.0, 234, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "order", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " order = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L120_C4", "label": "balance =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "vector": [14, 1, 0.8108, 0.0068, 1, 0.94, 0.25, 279, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "balance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " balance = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4", "label": "for product_id, qty, option_ids", "type": "for", "loc": [121, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "vector": [6, 1, 0.8514, 0.0743, 1, 0.94, 0.5, 936, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "product_id, qty, option_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for product_id, qty, option_ids in session.cart:\n products = store(store.product.id == product_id).select()\n if products:\n product = products[0]\n options = [store.option[id] for id in option_ids]# XXX store(store.option.id.belongs(option_ids)).select() if option_ids else []\n total_price = qty * (product.price + sum([option.price for option in options]))\n order.append((product_id, qty, total_price, product, options))\n balance += total_price"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L122_C8", "label": "products = select()", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4", "vector": [14, 2, 0.8243, 0.0068, 2, 0.63, 0.0, 789, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "products", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " products = store(store.product.id == product_id).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "label": "if", "type": "if", "loc": [123, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4", "vector": [4, 2, 0.8581, 0.0608, 2, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if products:\n product = products[0]\n options = [store.option[id] for id in option_ids]# XXX store(store.option.id.belongs(option_ids)).select() if option_ids else []\n total_price = qty * (product.price + sum([option.price for option in options]))\n order.append((product_id, qty, total_price, product, options))\n balance += total_price\n else:\n # invalid product"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L124_C12", "label": "product =", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "vector": [14, 3, 0.8378, 0.0068, 3, 0.28, 0.0, 196, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "product", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " product = products[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L125_C12", "label": "options =", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "vector": [14, 3, 0.8446, 0.0068, 3, 0.28, 0.3333, 707, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options = [store.option[id] for id in option_ids]# XXX store(store.option.id.belongs(option_ids)).select() if option_ids else []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L126_C12", "label": "total_price =", "type": "assigned_variable", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "vector": [14, 3, 0.8514, 0.0068, 3, 0.28, 0.6667, 79, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "total_price", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_price = qty * (product.price + sum([option.price for option in options]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L127_C12", "label": "append()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "vector": [8, 3, 0.8581, 0.0068, 3, 0.28, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " order.append((product_id, qty, total_price, product, options))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L132_C4", "label": "session.balance =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "vector": [14, 1, 0.8919, 0.0068, 1, 0.94, 0.75, 902, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "session.balance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.balance = balance # XXX is updating in time?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L133_C4", "label": "return", "type": "return", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "vector": [13, 1, 0.8986, 0.0068, 1, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(order=order, merchant_id=session.google_merchant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L135_C0", "label": "popup", "type": "function", "loc": [135, 136], "level": 0, "parent": null, "vector": [2, 0, 0.9155, 0.0135, 0, 0.66, 0.7692, 897, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "popup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def popup():\n return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L136_C4", "label": "return", "type": "return", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L135_C0", "vector": [13, 1, 0.9189, 0.0068, 1, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "label": "show", "type": "function", "loc": [138, 144], "level": 0, "parent": null, "vector": [2, 0, 0.9527, 0.0473, 0, 0.66, 0.8462, 497, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "show", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show():\n response.session_id = None\n import gluon.contenttype, os\n filename = '/'.join(request.args)\n response.headers['Content-Type'] = gluon.contenttype.contenttype(filename)\n # XXX is this path going to be a problem on Windows?\n return open(os.path.join(request.folder, 'uploads', filename), 'rb').read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L139_C4", "label": "response.session_id =", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "vector": [14, 1, 0.9392, 0.0068, 1, 0.39, 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"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Import_L140_C4", "label": "gluon.contenttype import gluon.contenttype, os", "type": "import", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "vector": [1, 1, 0.9459, 0.0068, 1, 0.39, 0.25, 919, 0, 2, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["gluon.contenttype", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.contenttype, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L141_C4", "label": "filename = join()", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "vector": [14, 1, 0.9527, 0.0068, 1, 0.39, 0.5, 275, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " filename = '/'.join(request.args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L142_C4", "label": " = contenttype()", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "vector": [14, 1, 0.9595, 0.0068, 1, 0.39, 0.75, 0, 3, 1, 0, 0, 97, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "contenttype", "annotation": ""}, "snippet": " response.headers['Content-Type'] = gluon.contenttype.contenttype(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L144_C4", "label": "return", "type": "return", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "vector": [13, 1, 0.973, 0.0068, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(os.path.join(request.folder, 'uploads', filename), 'rb').read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L146_C0", "label": "aboutus", "type": "function", "loc": [146, 146], "level": 0, "parent": null, "vector": [2, 0, 0.9865, 0.0068, 0, 0.66, 0.9231, 807, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "aboutus", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def aboutus(): return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L146_C15", "label": "return", "type": "return", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L146_C0", "vector": [13, 1, 0.9865, 0.0068, 1, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def aboutus(): return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L148_C0", "label": "contactus", "type": "function", "loc": [148, 148], "level": 0, "parent": null, "vector": [2, 0, 1.0, 0.0068, 0, 0.66, 1.0, 535, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "contactus", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def contactus(): return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L148_C17", "label": "return", "type": "return", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L148_C0", "vector": [13, 1, 1.0, 0.0068, 1, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def contactus(): return dict()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L23_C25"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:For_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:For_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L35_C26"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L46_C25"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L49_C21"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L86_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:For_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L135_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Import_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L146_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_4:FunctionDef_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_4:Return_L148_C17"}]
########################################################### ### make sure administrator is on localhost ############################################################ import os from gluon.contenttype import contenttype from gluon.fileutils import check_credentials, listdir if not session.authorized and not request.function=='login': redirect(URL(r=request,f='login')) response.view='manage.html' response.menu=[['manage',True,'/%s/manage/index' % (request.application)], ['logout',False,'/%s/manage/logout' % (request.application)], ['back to store',False,'/%s/default/index' % (request.application)]] ########################################################### ### list all tables in database ############################################################ def login(): response.view='manage/login.html' from gluon.fileutils import check_credentials if check_credentials(request,'admin'): session.authorized=True redirect(URL(r=request,f='index')) return dict() def logout(): session.authorized=False redirect(URL(r=request,c='default',f='index')) def index(): import types as _types _dbs={} for _key,_value in globals().items(): try: if _value.__class__==SQLDB: tables=_dbs[_key]=[] for _tablename in _value.tables(): tables.append((_key,_tablename)) except: pass return dict(dbs=_dbs) ########################################################### ### insert a new record ############################################################ def insert(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] form=SQLFORM(db[table]) except: redirect(URL(r=request,f='index')) if form.accepts(request.vars,session): response.flash='new record inserted' redirect(URL(r=request,f='select',args=request.args)) elif len(request.vars): response.flash='There are error in your submission form' return dict(form=form) ########################################################### ### list all records in table and insert new record ############################################################ def download(): filename=request.args[0] response.headers['Content-Type']=contenttype(filename) return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read() def csv(): import gluon.contenttype, csv, cStringIO response.headers['Content-Type']=gluon.contenttype.contenttype('.csv') try: dbname=request.vars.dbname db=eval(dbname) records=db(request.vars.query).select() except: redirect(URL(r=request,f='index')) s=cStringIO.StringIO() writer = csv.writer(s) writer.writerow(records.colnames) c=range(len(records.colnames)) for i in range(len(records)): writer.writerow([records.response[i][j] for j in c]) ### FILL HERE return s.getvalue() def import_csv(table,file): import csv reader = csv.reader(file) colnames=None for line in reader: if not colnames: colnames=[x[x.find('.')+1:] for x in line] c=[i for i in range(len(line)) if colnames[i]!='id'] else: items=[(colnames[i],line[i]) for i in c] table.insert(**dict(items)) def select(): try: dbname=request.args[0] db=eval(dbname) if not request.vars.query: table=request.args[1] query='%s.id>0' % table else: query=request.vars.query except: redirect(URL(r=request,f='index')) if request.vars.csvfile!=None: try: import_csv(db[table],request.vars.csvfile.file) response.flash='data uploaded' except: reponse.flash='unable to parse csv file' if request.vars.delete_all and request.vars.delete_all_sure=='yes': try: db(query).delete() response.flash='records deleted' except: response.flash='invalid SQL FILTER' elif request.vars.update_string: try: env=dict(db=db,query=query) exec('db(query).update('+request.vars.update_string+')') in env response.flash='records updated' except: response.flash='invalid SQL FILTER or UPDATE STRING' if request.vars.start: start=int(request.vars.start) else: start=0 limitby=(start,start+100) try: records=db(query).select(limitby=limitby) except: response.flash='invalid SQL FILTER' return dict(records='no records',nrecords=0,query=query,start=0) linkto=URL(r=request,f='update/%s'% (dbname)) upload=URL(r=request,f='download') return dict(start=start,query=query,\ nrecords=len(records),\ records=SQLTABLE(records,linkto,upload,_class='sortable')) ########################################################### ### edit delete one record ############################################################ def update(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] except: redirect(URL(r=request,f='index')) try: id=int(request.args[2]) record=db(db[table].id==id).select()[0] except: redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) form=SQLFORM(db[table],record,deletable=True, linkto=URL(r=request,f='select/'+dbname), upload=URL(r=request,f='download/')) if form.accepts(request.vars,session): response.flash='done!' redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) return dict(form=form) def cleanup(): app=request.application files=listdir('applications/%s/cache/' % app,'',0) for file in files: os.unlink(file) files=listdir('applications/%s/errors/' % app,'',0) for file in files: os.unlink(file) files=listdir('applications/%s/sessions/' % app,'',0) for file in files: os.unlink(file) session.flash="cache, errors and sessions cleaned" redirect(URL(r=request,f='index')) def setup(): response.view='manage/setup.html' form=SQLFORM(store.info,mystore) if form.accepts(request.vars,session): response.flash='that was easy! now go vist your store.' else: response.flash='welcome to the store-in-a-stick setup' return dict(form=form)
ajibawa-2023/Python-Code-Large/train/row_5
140
180
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0056, 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_5:ImportFrom_L6_C0", "label": "from gluon.contenttype import contenttype", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0056, 0, 0.66, 0.0625, 919, 0, 1, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["contenttype"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.contenttype import contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:ImportFrom_L7_C0", "label": "from gluon.fileutils import check_credentials, listdir", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0389, 0.0056, 0, 0.66, 0.125, 948, 0, 2, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["check_credentials", "listdir"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.fileutils import check_credentials, listdir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L9_C0", "label": "if", "type": "if", "loc": [9, 10], "level": 0, "parent": null, "vector": [4, 0, 0.0528, 0.0111, 0, 0.66, 0.1875, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not session.authorized and not request.function=='login':\n redirect(URL(r=request,f='login'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L10_C4", "label": "redirect()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L9_C0", "vector": [8, 1, 0.0556, 0.0056, 1, 0.88, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='login'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L12_C0", "label": "response.view =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0667, 0.0056, 0, 0.66, 0.25, 301, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.view='manage.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L13_C0", "label": "response.menu =", "type": "assigned_variable", "loc": [13, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0778, 0.0167, 0, 0.66, 0.3125, 367, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "response.menu", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.menu=[['manage',True,'/%s/manage/index' % (request.application)],\n ['logout',False,'/%s/manage/logout' % (request.application)],\n ['back to store',False,'/%s/default/index' % (request.application)]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "label": "login", "type": "function", "loc": [21, 27], "level": 0, "parent": null, "vector": [2, 0, 0.1333, 0.0389, 0, 0.66, 0.375, 724, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "login", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def login():\n response.view='manage/login.html'\n from gluon.fileutils import check_credentials\n if check_credentials(request,'admin'):\n session.authorized=True\n redirect(URL(r=request,f='index'))\n return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L22_C4", "label": "response.view =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "vector": [14, 1, 0.1222, 0.0056, 1, 0.56, 0.0, 301, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.view='manage/login.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:ImportFrom_L23_C4", "label": "from gluon.fileutils import check_credentials", "type": "import", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "vector": [1, 1, 0.1278, 0.0056, 1, 0.56, 0.3333, 948, 0, 1, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["check_credentials"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.fileutils import check_credentials"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4", "label": "if", "type": "if", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "vector": [4, 1, 0.1389, 0.0167, 1, 0.56, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if check_credentials(request,'admin'):\n session.authorized=True\n redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L25_C8", "label": "session.authorized =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4", "vector": [14, 2, 0.1389, 0.0056, 2, 0.27, 0.0, 495, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "session.authorized", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.authorized=True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L26_C8", "label": "redirect()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4", "vector": [8, 2, 0.1444, 0.0056, 2, 0.27, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L27_C4", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "vector": [13, 1, 0.15, 0.0056, 1, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L29_C0", "label": "logout", "type": "function", "loc": [29, 31], "level": 0, "parent": null, "vector": [2, 0, 0.1667, 0.0167, 0, 0.66, 0.4375, 525, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "logout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def logout():\n session.authorized=False\n redirect(URL(r=request,c='default',f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L30_C4", "label": "session.authorized =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L29_C0", "vector": [14, 1, 0.1667, 0.0056, 1, 0.33, 0.0, 495, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "session.authorized", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.authorized=False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L31_C4", "label": "redirect()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L29_C0", "vector": [8, 1, 0.1722, 0.0056, 1, 0.33, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,c='default',f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "label": "index", "type": "function", "loc": [33, 43], "level": 0, "parent": null, "vector": [2, 0, 0.2111, 0.0611, 0, 0.66, 0.5, 780, 0, 0, 1, 0, 0, 0, 5], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index():\n import types as _types\n _dbs={}\n for _key,_value in globals().items():\n try:\n if _value.__class__==SQLDB:\n tables=_dbs[_key]=[] \n for _tablename in _value.tables():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L34_C4", "label": "types import _types", "type": "import", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "vector": [1, 1, 0.1889, 0.0056, 1, 0.17, 0.0, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["_types"], "rhs_call_name": "", "annotation": ""}, "snippet": " import types as _types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L35_C4", "label": "_dbs =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "vector": [14, 1, 0.1944, 0.0056, 1, 0.17, 0.3333, 721, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_dbs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _dbs={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L36_C4", "label": "for _key, _value", "type": "for", "loc": [36, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "vector": [6, 1, 0.2167, 0.0389, 1, 0.17, 0.6667, 549, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "_key, _value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for _key,_value in globals().items():\n try:\n if _value.__class__==SQLDB:\n tables=_dbs[_key]=[] \n for _tablename in _value.tables():\n tables.append((_key,_tablename))\n except: pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L37_C8", "label": "try", "type": "try", "loc": [37, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L36_C4", "vector": [7, 2, 0.2194, 0.0333, 2, 0.2, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if _value.__class__==SQLDB:\n tables=_dbs[_key]=[] \n for _tablename in _value.tables():\n tables.append((_key,_tablename))\n except: pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12", "label": "if", "type": "if", "loc": [38, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L37_C8", "vector": [4, 3, 0.2194, 0.0222, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _value.__class__==SQLDB:\n tables=_dbs[_key]=[] \n for _tablename in _value.tables():\n tables.append((_key,_tablename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L39_C16", "label": "tables =", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12", "vector": [14, 4, 0.2167, 0.0056, 4, 0.48, 0.0, 475, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tables", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tables=_dbs[_key]=[] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L40_C16", "label": "for _tablename", "type": "for", "loc": [40, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12", "vector": [6, 4, 0.225, 0.0111, 4, 0.48, 1.0, 160, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "_tablename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for _tablename in _value.tables():\n tables.append((_key,_tablename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L41_C20", "label": "append()", "type": "expression", "loc": [41, 41], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L40_C16", "vector": [8, 5, 0.2278, 0.0056, 5, 0.51, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " tables.append((_key,_tablename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "vector": [13, 1, 0.2389, 0.0056, 1, 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(dbs=_dbs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "label": "insert", "type": "function", "loc": [49, 61], "level": 0, "parent": null, "vector": [2, 0, 0.3056, 0.0722, 0, 0.66, 0.5625, 368, 0, 0, 1, 0, 0, 0, 9], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def insert():\n try:\n dbname=request.args[0]\n db=eval(dbname)\n table=request.args[1]\n form=SQLFORM(db[table])\n except: redirect(URL(r=request,f='index'))\n if form.accepts(request.vars,session):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "label": "try", "type": "try", "loc": [50, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "vector": [7, 1, 0.2917, 0.0333, 1, 0.67, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n dbname=request.args[0]\n db=eval(dbname)\n table=request.args[1]\n form=SQLFORM(db[table])\n except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L51_C8", "label": "dbname =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "vector": [14, 2, 0.2833, 0.0056, 2, 0.69, 0.0, 396, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbname=request.args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L52_C8", "label": "db = eval()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "vector": [14, 2, 0.2889, 0.0056, 2, 0.69, 0.3333, 761, 3, 1, 0, 0, 776, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " db=eval(dbname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L53_C8", "label": "table =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "vector": [14, 2, 0.2944, 0.0056, 2, 0.69, 0.6667, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table=request.args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L54_C8", "label": "form = SQLFORM()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "vector": [14, 2, 0.3, 0.0056, 2, 0.69, 1.0, 761, 3, 1, 0, 0, 723, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " form=SQLFORM(db[table])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L55_C12", "label": "redirect()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "vector": [8, 2, 0.3056, 0.0056, 2, 0.69, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "label": "if", "type": "if", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "vector": [4, 1, 0.3222, 0.0278, 1, 0.67, 0.5, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,session):\n response.flash='new record inserted'\n redirect(URL(r=request,f='select',args=request.args))\n elif len(request.vars):\n response.flash='There are error in your submission form'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L57_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "vector": [14, 2, 0.3167, 0.0056, 2, 0.4, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='new record inserted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L58_C8", "label": "redirect()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "vector": [8, 2, 0.3222, 0.0056, 2, 0.4, 0.5, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='select',args=request.args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "vector": [4, 2, 0.3306, 0.0111, 2, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(request.vars):\n response.flash='There are error in your submission form'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L60_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L59_C4", "vector": [14, 3, 0.3333, 0.0056, 3, 0.65, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='There are error in your submission form'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "vector": [13, 1, 0.3389, 0.0056, 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 dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "label": "download", "type": "function", "loc": [67, 70], "level": 0, "parent": null, "vector": [2, 0, 0.3806, 0.0222, 0, 0.66, 0.625, 0, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "download", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download():\n filename=request.args[0]\n response.headers['Content-Type']=contenttype(filename)\n return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L68_C4", "label": "filename =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "vector": [14, 1, 0.3778, 0.0056, 1, 0.65, 0.0, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename=request.args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L69_C4", "label": " = contenttype()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "vector": [14, 1, 0.3833, 0.0056, 1, 0.65, 0.5, 0, 3, 1, 0, 0, 97, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "contenttype", "annotation": ""}, "snippet": " response.headers['Content-Type']=contenttype(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "vector": [13, 1, 0.3889, 0.0056, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "label": "csv", "type": "function", "loc": [72, 87], "level": 0, "parent": null, "vector": [2, 0, 0.4417, 0.0889, 0, 0.66, 0.6875, 312, 0, 0, 1, 0, 0, 0, 15], "semantic": {"name": "csv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def csv():\n import gluon.contenttype, csv, cStringIO\n response.headers['Content-Type']=gluon.contenttype.contenttype('.csv')\n try:\n dbname=request.vars.dbname\n db=eval(dbname)\n records=db(request.vars.query).select()\n except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L73_C4", "label": "gluon.contenttype import gluon.contenttype, csv, cStringIO", "type": "import", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [1, 1, 0.4056, 0.0056, 1, 0.25, 0.0, 919, 0, 3, 0, 0, 919, 0, 0], "semantic": {"name": "gluon.contenttype", "arg_names": [], "import_names": ["gluon.contenttype", "csv", "cStringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.contenttype, csv, cStringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L74_C4", "label": " = contenttype()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [14, 1, 0.4111, 0.0056, 1, 0.25, 0.125, 0, 3, 1, 0, 0, 97, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "contenttype", "annotation": ""}, "snippet": " response.headers['Content-Type']=gluon.contenttype.contenttype('.csv')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "label": "try", "type": "try", "loc": [75, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [7, 1, 0.4278, 0.0278, 1, 0.25, 0.25, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n dbname=request.vars.dbname\n db=eval(dbname)\n records=db(request.vars.query).select()\n except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L76_C8", "label": "dbname =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "vector": [14, 2, 0.4222, 0.0056, 2, 0.28, 0.0, 396, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbname=request.vars.dbname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L77_C8", "label": "db = eval()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "vector": [14, 2, 0.4278, 0.0056, 2, 0.28, 0.5, 761, 3, 1, 0, 0, 776, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " db=eval(dbname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L78_C8", "label": "records = select()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "vector": [14, 2, 0.4333, 0.0056, 2, 0.28, 1.0, 186, 3, 0, 0, 0, 438, 10, 2], "semantic": {"name": "records", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " records=db(request.vars.query).select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L79_C12", "label": "redirect()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "vector": [8, 2, 0.4389, 0.0056, 2, 0.28, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L80_C4", "label": "s = StringIO()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [14, 1, 0.4444, 0.0056, 1, 0.25, 0.375, 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_5:Assign_L81_C4", "label": "writer = writer()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [14, 1, 0.45, 0.0056, 1, 0.25, 0.5, 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_5:Expr_L82_C4", "label": "writerow()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [8, 1, 0.4556, 0.0056, 1, 0.25, 0.625, 941, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerow", "arg_names": [], "import_names": [], "rhs_call_name": "writerow", "annotation": ""}, "snippet": " writer.writerow(records.colnames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L83_C4", "label": "c = range()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [14, 1, 0.4611, 0.0056, 1, 0.25, 0.75, 411, 3, 1, 0, 0, 816, 10, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "range", "annotation": ""}, "snippet": " c=range(len(records.colnames))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L84_C4", "label": "for i", "type": "for", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [6, 1, 0.4694, 0.0111, 1, 0.25, 0.875, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(records)):\n writer.writerow([records.response[i][j] for j in c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L85_C8", "label": "writerow()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L84_C4", "vector": [8, 2, 0.4722, 0.0056, 2, 0.49, 0.0, 941, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerow", "arg_names": [], "import_names": [], "rhs_call_name": "writerow", "annotation": ""}, "snippet": " writer.writerow([records.response[i][j] for j in c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L87_C4", "label": "return", "type": "return", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "vector": [13, 1, 0.4833, 0.0056, 1, 0.25, 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_5:FunctionDef_L89_C0", "label": "import_csv", "type": "function", "loc": [89, 99], "level": 0, "parent": null, "vector": [2, 0, 0.5222, 0.0611, 0, 0.66, 0.75, 932, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "import_csv", "arg_names": ["table", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def import_csv(table,file):\n import csv\n reader = csv.reader(file)\n colnames=None\n for line in reader:\n if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L90_C4", "label": "csv import csv", "type": "import", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "vector": [1, 1, 0.5, 0.0056, 1, 0.03, 0.0, 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_5:Assign_L91_C4", "label": "reader = reader()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "vector": [14, 1, 0.5056, 0.0056, 1, 0.03, 0.3333, 548, 3, 1, 0, 0, 548, 10, 1], "semantic": {"name": "reader", "arg_names": [], "import_names": [], "rhs_call_name": "reader", "annotation": ""}, "snippet": " reader = csv.reader(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L92_C4", "label": "colnames =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "vector": [14, 1, 0.5111, 0.0056, 1, 0.03, 0.6667, 849, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colnames=None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L93_C4", "label": "for line", "type": "for", "loc": [93, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "vector": [6, 1, 0.5333, 0.0389, 1, 0.03, 1.0, 373, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in reader:\n if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] \n else:\n items=[(colnames[i],line[i]) for i in c]\n table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "label": "if", "type": "if", "loc": [94, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L93_C4", "vector": [4, 2, 0.5361, 0.0333, 2, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not colnames: \n colnames=[x[x.find('.')+1:] for x in line]\n c=[i for i in range(len(line)) if colnames[i]!='id'] \n else:\n items=[(colnames[i],line[i]) for i in c]\n table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L95_C12", "label": "colnames =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "vector": [14, 3, 0.5278, 0.0056, 3, 0.13, 0.0, 849, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colnames=[x[x.find('.')+1:] for x in line]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L96_C12", "label": "c =", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "vector": [14, 3, 0.5333, 0.0056, 3, 0.13, 0.3333, 411, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c=[i for i in range(len(line)) if colnames[i]!='id'] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L98_C12", "label": "items =", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "vector": [14, 3, 0.5444, 0.0056, 3, 0.13, 0.6667, 339, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items=[(colnames[i],line[i]) for i in c]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L99_C12", "label": "insert()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "vector": [8, 3, 0.55, 0.0056, 3, 0.13, 1.0, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " table.insert(**dict(items))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "label": "select", "type": "function", "loc": [101, 138], "level": 0, "parent": null, "vector": [2, 0, 0.6639, 0.2111, 0, 0.66, 0.8125, 438, 0, 0, 1, 0, 0, 0, 17], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def select():\n try:\n dbname=request.args[0]\n db=eval(dbname)\n if not request.vars.query:\n table=request.args[1]\n query='%s.id>0' % table \n else: query=request.vars.query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "label": "try", "type": "try", "loc": [102, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [7, 1, 0.5861, 0.0444, 1, 0.85, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n dbname=request.args[0]\n db=eval(dbname)\n if not request.vars.query:\n table=request.args[1]\n query='%s.id>0' % table \n else: query=request.vars.query\n except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L103_C8", "label": "dbname =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "vector": [14, 2, 0.5722, 0.0056, 2, 0.13, 0.0, 396, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbname=request.args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L104_C8", "label": "db = eval()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "vector": [14, 2, 0.5778, 0.0056, 2, 0.13, 0.5, 761, 3, 1, 0, 0, 776, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " db=eval(dbname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "label": "if", "type": "if", "loc": [105, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "vector": [4, 2, 0.5917, 0.0222, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not request.vars.query:\n table=request.args[1]\n query='%s.id>0' % table \n else: query=request.vars.query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L106_C12", "label": "table =", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "vector": [14, 3, 0.5889, 0.0056, 3, 0.95, 0.0, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table=request.args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L107_C12", "label": "query =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "vector": [14, 3, 0.5944, 0.0056, 3, 0.95, 0.5, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query='%s.id>0' % table "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L108_C14", "label": "query =", "type": "assigned_variable", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "vector": [14, 3, 0.6, 0.0056, 3, 0.95, 1.0, 546, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: query=request.vars.query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L109_C12", "label": "redirect()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "vector": [8, 2, 0.6056, 0.0056, 2, 0.13, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L110_C4", "label": "if", "type": "if", "loc": [110, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [4, 1, 0.6222, 0.0278, 1, 0.85, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.csvfile!=None: \n try:\n import_csv(db[table],request.vars.csvfile.file)\n response.flash='data uploaded'\n except: reponse.flash='unable to parse csv file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "label": "try", "type": "try", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L110_C4", "vector": [7, 2, 0.625, 0.0222, 2, 0.1, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import_csv(db[table],request.vars.csvfile.file)\n response.flash='data uploaded'\n except: reponse.flash='unable to parse csv file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L112_C12", "label": "import_csv()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "vector": [8, 3, 0.6222, 0.0056, 3, 0.54, 0.0, 932, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "import_csv", "arg_names": [], "import_names": [], "rhs_call_name": "import_csv", "annotation": ""}, "snippet": " import_csv(db[table],request.vars.csvfile.file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L113_C12", "label": "response.flash =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "vector": [14, 3, 0.6278, 0.0056, 3, 0.54, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='data uploaded'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L114_C16", "label": "reponse.flash =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "vector": [14, 3, 0.6333, 0.0056, 3, 0.54, 0.0, 847, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "reponse.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " except: reponse.flash='unable to parse csv file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4", "label": "if", "type": "if", "loc": [115, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [4, 1, 0.6667, 0.0611, 1, 0.85, 0.25, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.delete_all and request.vars.delete_all_sure=='yes':\n try:\n db(query).delete()\n response.flash='records deleted'\n except: response.flash='invalid SQL FILTER'\n elif request.vars.update_string:\n try:\n env=dict(db=db,query=query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "label": "try", "type": "try", "loc": [116, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4", "vector": [7, 2, 0.6528, 0.0222, 2, 0.03, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n db(query).delete()\n response.flash='records deleted'\n except: response.flash='invalid SQL FILTER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L117_C12", "label": "delete()", "type": "expression", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "vector": [8, 3, 0.65, 0.0056, 3, 0.58, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db(query).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L118_C12", "label": "response.flash =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "vector": [14, 3, 0.6556, 0.0056, 3, 0.58, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='records deleted'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L119_C16", "label": "response.flash =", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "vector": [14, 3, 0.6611, 0.0056, 3, 0.58, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " except: response.flash='invalid SQL FILTER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L120_C4", "label": "if", "type": "if", "loc": [120, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4", "vector": [4, 2, 0.6806, 0.0333, 2, 0.03, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif request.vars.update_string:\n try:\n env=dict(db=db,query=query)\n exec('db(query).update('+request.vars.update_string+')') in env\n response.flash='records updated'\n except: response.flash='invalid SQL FILTER or UPDATE STRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "label": "try", "type": "try", "loc": [121, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L120_C4", "vector": [7, 3, 0.6833, 0.0278, 3, 0.44, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n env=dict(db=db,query=query)\n exec('db(query).update('+request.vars.update_string+')') in env\n response.flash='records updated'\n except: response.flash='invalid SQL FILTER or UPDATE STRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L122_C12", "label": "env = dict()", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "vector": [14, 4, 0.6778, 0.0056, 4, 0.14, 0.0, 803, 3, 2, 0, 0, 827, 10, 1], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " env=dict(db=db,query=query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L123_C12", "label": "expression", "type": "expression", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "vector": [8, 4, 0.6833, 0.0056, 4, 0.14, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exec('db(query).update('+request.vars.update_string+')') in env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L124_C12", "label": "response.flash =", "type": "assigned_variable", "loc": [124, 124], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "vector": [14, 4, 0.6889, 0.0056, 4, 0.14, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='records updated'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L125_C16", "label": "response.flash =", "type": "assigned_variable", "loc": [125, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "vector": [14, 4, 0.6944, 0.0056, 4, 0.14, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " except: response.flash='invalid SQL FILTER or UPDATE STRING'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4", "label": "if", "type": "if", "loc": [126, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [4, 1, 0.7028, 0.0111, 1, 0.85, 0.375, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.start: start=int(request.vars.start)\n else: start=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L126_C27", "label": "start = int()", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4", "vector": [14, 2, 0.7, 0.0056, 2, 0.22, 0.0, 511, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " if request.vars.start: start=int(request.vars.start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L127_C10", "label": "start =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4", "vector": [14, 2, 0.7056, 0.0056, 2, 0.22, 1.0, 511, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: start=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L128_C4", "label": "limitby =", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [14, 1, 0.7111, 0.0056, 1, 0.85, 0.5, 206, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "limitby", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limitby=(start,start+100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "label": "try", "type": "try", "loc": [129, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [7, 1, 0.7278, 0.0278, 1, 0.85, 0.625, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n records=db(query).select(limitby=limitby)\n except: \n response.flash='invalid SQL FILTER'\n return dict(records='no records',nrecords=0,query=query,start=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L130_C8", "label": "records = select()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "vector": [14, 2, 0.7222, 0.0056, 2, 0.81, 0.0, 186, 3, 1, 0, 0, 438, 10, 2], "semantic": {"name": "records", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " records=db(query).select(limitby=limitby)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L132_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "vector": [14, 2, 0.7333, 0.0056, 2, 0.81, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='invalid SQL FILTER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L133_C8", "label": "return", "type": "return", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "vector": [13, 2, 0.7389, 0.0056, 2, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(records='no records',nrecords=0,query=query,start=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L134_C4", "label": "linkto = URL()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [14, 1, 0.7444, 0.0056, 1, 0.85, 0.75, 143, 3, 2, 0, 0, 759, 10, 1], "semantic": {"name": "linkto", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " linkto=URL(r=request,f='update/%s'% (dbname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L135_C4", "label": "upload = URL()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [14, 1, 0.75, 0.0056, 1, 0.85, 0.875, 920, 3, 2, 0, 0, 759, 10, 1], "semantic": {"name": "upload", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " upload=URL(r=request,f='download')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L136_C4", "label": "return", "type": "return", "loc": [136, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "vector": [13, 1, 0.7611, 0.0167, 1, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(start=start,query=query,\\\n nrecords=len(records),\\\n records=SQLTABLE(records,linkto,upload,_class='sortable'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "label": "update", "type": "function", "loc": [144, 160], "level": 0, "parent": null, "vector": [2, 0, 0.8444, 0.0944, 0, 0.66, 0.875, 637, 0, 0, 1, 0, 0, 0, 15], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update():\n try:\n dbname=request.args[0]\n db=eval(dbname)\n table=request.args[1]\n except: redirect(URL(r=request,f='index'))\n try:\n id=int(request.args[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "label": "try", "type": "try", "loc": [145, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "vector": [7, 1, 0.8167, 0.0278, 1, 0.45, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n dbname=request.args[0]\n db=eval(dbname)\n table=request.args[1]\n except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L146_C8", "label": "dbname =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "vector": [14, 2, 0.8111, 0.0056, 2, 0.53, 0.0, 396, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbname=request.args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L147_C8", "label": "db = eval()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "vector": [14, 2, 0.8167, 0.0056, 2, 0.53, 0.5, 761, 3, 1, 0, 0, 776, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " db=eval(dbname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L148_C8", "label": "table =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "vector": [14, 2, 0.8222, 0.0056, 2, 0.53, 1.0, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table=request.args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L149_C12", "label": "redirect()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "vector": [8, 2, 0.8278, 0.0056, 2, 0.53, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " except: redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "label": "try", "type": "try", "loc": [150, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "vector": [7, 1, 0.8417, 0.0222, 1, 0.45, 0.25, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n id=int(request.args[2])\n record=db(db[table].id==id).select()[0]\n except: redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L151_C8", "label": "id = int()", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "vector": [14, 2, 0.8389, 0.0056, 2, 0.56, 0.0, 941, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " id=int(request.args[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L152_C8", "label": "record =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "vector": [14, 2, 0.8444, 0.0056, 2, 0.56, 1.0, 667, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " record=db(db[table].id==id).select()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L153_C12", "label": "redirect()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "vector": [8, 2, 0.85, 0.0056, 2, 0.56, 0.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " except: redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L154_C4", "label": "form = SQLFORM()", "type": "assigned_variable", "loc": [154, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "vector": [14, 1, 0.8611, 0.0167, 1, 0.45, 0.5, 761, 3, 5, 0, 0, 723, 10, 3], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " form=SQLFORM(db[table],record,deletable=True,\n linkto=URL(r=request,f='select/'+dbname),\n upload=URL(r=request,f='download/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4", "label": "if", "type": "if", "loc": [157, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "vector": [4, 1, 0.8778, 0.0167, 1, 0.45, 0.75, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,session): \n response.flash='done!' \n redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L158_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4", "vector": [14, 2, 0.8778, 0.0056, 2, 0.76, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='done!' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L159_C8", "label": "redirect()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4", "vector": [8, 2, 0.8833, 0.0056, 2, 0.76, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='select/%s/%s'%(dbname,table)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L160_C4", "label": "return", "type": "return", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "vector": [13, 1, 0.8889, 0.0056, 1, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "label": "cleanup", "type": "function", "loc": [162, 171], "level": 0, "parent": null, "vector": [2, 0, 0.925, 0.0556, 0, 0.66, 0.9375, 656, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "cleanup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cleanup():\n app=request.application\n files=listdir('applications/%s/cache/' % app,'',0)\n for file in files: os.unlink(file)\n files=listdir('applications/%s/errors/' % app,'',0)\n for file in files: os.unlink(file)\n files=listdir('applications/%s/sessions/' % app,'',0)\n for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L163_C4", "label": "app =", "type": "assigned_variable", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [14, 1, 0.9056, 0.0056, 1, 0.13, 0.0, 494, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app=request.application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L164_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [14, 1, 0.9111, 0.0056, 1, 0.13, 0.125, 598, 3, 3, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files=listdir('applications/%s/cache/' % app,'',0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L165_C4", "label": "for file", "type": "for", "loc": [165, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [6, 1, 0.9167, 0.0056, 1, 0.13, 0.25, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L165_C23", "label": "unlink()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L165_C4", "vector": [8, 2, 0.9167, 0.0056, 2, 0.51, 0.0, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L166_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [14, 1, 0.9222, 0.0056, 1, 0.13, 0.375, 598, 3, 3, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files=listdir('applications/%s/errors/' % app,'',0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L167_C4", "label": "for file", "type": "for", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [6, 1, 0.9278, 0.0056, 1, 0.13, 0.5, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L167_C23", "label": "unlink()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L167_C4", "vector": [8, 2, 0.9278, 0.0056, 2, 0.96, 0.0, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L168_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [14, 1, 0.9333, 0.0056, 1, 0.13, 0.625, 598, 3, 3, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files=listdir('applications/%s/sessions/' % app,'',0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:For_L169_C4", "label": "for file", "type": "for", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [6, 1, 0.9389, 0.0056, 1, 0.13, 0.75, 107, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L169_C23", "label": "unlink()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:For_L169_C4", "vector": [8, 2, 0.9389, 0.0056, 2, 0.16, 0.0, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " for file in files: os.unlink(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L170_C4", "label": "session.flash =", "type": "assigned_variable", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [14, 1, 0.9444, 0.0056, 1, 0.13, 0.875, 837, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "session.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " session.flash=\"cache, errors and sessions cleaned\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L171_C4", "label": "redirect()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "vector": [8, 1, 0.95, 0.0056, 1, 0.13, 1.0, 206, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(URL(r=request,f='index'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "label": "setup", "type": "function", "loc": [173, 180], "level": 0, "parent": null, "vector": [2, 0, 0.9806, 0.0444, 0, 0.66, 1.0, 234, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup():\n response.view='manage/setup.html'\n form=SQLFORM(store.info,mystore)\n if form.accepts(request.vars,session):\n response.flash='that was easy! now go vist your store.'\n else:\n response.flash='welcome to the store-in-a-stick setup' \n return dict(form=form)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L174_C4", "label": "response.view =", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "vector": [14, 1, 0.9667, 0.0056, 1, 0.02, 0.0, 301, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.view='manage/setup.html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L175_C4", "label": "form = SQLFORM()", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "vector": [14, 1, 0.9722, 0.0056, 1, 0.02, 0.3333, 761, 3, 2, 0, 0, 723, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "SQLFORM", "annotation": ""}, "snippet": " form=SQLFORM(store.info,mystore)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4", "label": "if", "type": "if", "loc": [176, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "vector": [4, 1, 0.9861, 0.0222, 1, 0.02, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.accepts(request.vars,session):\n response.flash='that was easy! now go vist your store.'\n else:\n response.flash='welcome to the store-in-a-stick setup' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L177_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4", "vector": [14, 2, 0.9833, 0.0056, 2, 0.67, 0.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='that was easy! now go vist your store.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L179_C8", "label": "response.flash =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4", "vector": [14, 2, 0.9944, 0.0056, 2, 0.67, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.flash='welcome to the store-in-a-stick setup' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L180_C4", "label": "return", "type": "return", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "vector": [13, 1, 1.0, 0.0056, 1, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=form)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:ImportFrom_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L39_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L40_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L41_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Import_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L108_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L119_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L126_C27"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L127_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:Try_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L165_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L167_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:For_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:For_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L169_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_5:FunctionDef_L173_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_5:Return_L180_C4"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''The setup and build script for the python-twitter library.''' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8.5' # The base package metadata to be used by both distutils and setuptools METADATA = dict( name = "python-twitter", version = __version__, py_modules = ['twitter'], author='The Python-Twitter Developers', author_email='python-twitter@googlegroups.com', description='A python wrapper around the Twitter API', license='Apache License 2.0', url='https://github.com/bear/python-twitter', keywords='twitter api', ) # Extra package metadata to be used only if setuptools is installed SETUPTOOLS_METADATA = dict( install_requires = ['setuptools', 'simplejson', 'oauth2'], include_package_data = True, classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Communications :: Chat', 'Topic :: Internet', ], test_suite = 'twitter_test.suite', ) def Read(file): return open(file).read() def BuildLongDescription(): return '\n'.join([Read('README.md'), Read('CHANGES')]) def Main(): # Build the long_description from the README and CHANGES METADATA['long_description'] = BuildLongDescription() # Use setuptools if available, otherwise fallback and use distutils try: import setuptools METADATA.update(SETUPTOOLS_METADATA) setuptools.setup(**METADATA) except ImportError: import distutils.core distutils.core.setup(**METADATA) if __name__ == '__main__': Main()
ajibawa-2023/Python-Code-Large/train/row_6
19
73
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2329, 0.0137, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''The setup and build script for the python-twitter library.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L19_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.2603, 0.0137, 0, 0.66, 0.125, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'python-twitter@googlegroups.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L20_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.274, 0.0137, 0, 0.66, 0.25, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '0.8.5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L24_C0", "label": "METADATA = dict()", "type": "assigned_variable", "loc": [24, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3973, 0.1507, 0, 0.66, 0.375, 622, 3, 9, 0, 0, 827, 10, 1], "semantic": {"name": "METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "METADATA = dict(\n name = \"python-twitter\",\n version = __version__,\n py_modules = ['twitter'],\n author='The Python-Twitter Developers',\n author_email='python-twitter@googlegroups.com',\n description='A python wrapper around the Twitter API',\n license='Apache License 2.0',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L37_C0", "label": "SETUPTOOLS_METADATA = dict()", "type": "assigned_variable", "loc": [37, 49], "level": 0, "parent": null, "vector": [14, 0, 0.589, 0.1781, 0, 0.66, 0.5, 22, 3, 4, 0, 0, 827, 10, 1], "semantic": {"name": "SETUPTOOLS_METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "SETUPTOOLS_METADATA = dict(\n install_requires = ['setuptools', 'simplejson', 'oauth2'],\n include_package_data = True,\n classifiers = [\n 'Development Status :: 4 - Beta',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: Apache Software License',\n 'Topic :: Software Development :: Libraries :: Python Modules',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L52_C0", "label": "Read", "type": "function", "loc": [52, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7192, 0.0274, 0, 0.66, 0.625, 771, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "Read", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Read(file):\n return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Return_L53_C2", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L52_C0", "vector": [13, 1, 0.726, 0.0137, 1, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L55_C0", "label": "BuildLongDescription", "type": "function", "loc": [55, 56], "level": 0, "parent": null, "vector": [2, 0, 0.7603, 0.0274, 0, 0.66, 0.75, 383, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "BuildLongDescription", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def BuildLongDescription():\n return '\\n'.join([Read('README.md'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L55_C0", "vector": [13, 1, 0.7671, 0.0137, 1, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join([Read('README.md'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L58_C0", "label": "Main", "type": "function", "loc": [58, 69], "level": 0, "parent": null, "vector": [2, 0, 0.8699, 0.1644, 0, 0.66, 0.875, 16, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "Main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Main():\n # Build the long_description from the README and CHANGES\n METADATA['long_description'] = BuildLongDescription()\n\n # Use setuptools if available, otherwise fallback and use distutils\n try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L60_C2", "label": " = BuildLongDescription()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L58_C0", "vector": [14, 1, 0.8219, 0.0137, 1, 0.32, 0.0, 0, 3, 0, 0, 0, 383, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "BuildLongDescription", "annotation": ""}, "snippet": " METADATA['long_description'] = BuildLongDescription()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "label": "try", "type": "try", "loc": [63, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L58_C0", "vector": [7, 1, 0.9041, 0.0959, 1, 0.32, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)\n setuptools.setup(**METADATA)\n except ImportError:\n import distutils.core\n distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Import_L64_C4", "label": "setuptools import setuptools", "type": "import", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "vector": [1, 2, 0.8767, 0.0137, 2, 0.83, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setuptools"], "rhs_call_name": "", "annotation": ""}, "snippet": " import setuptools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L65_C4", "label": "update()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "vector": [8, 2, 0.8904, 0.0137, 2, 0.83, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L66_C4", "label": "setup()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "vector": [8, 2, 0.9041, 0.0137, 2, 0.83, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " setuptools.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Import_L68_C4", "label": "distutils.core import distutils.core", "type": "import", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "vector": [1, 2, 0.9315, 0.0137, 2, 0.83, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["distutils.core"], "rhs_call_name": "", "annotation": ""}, "snippet": " import distutils.core"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L69_C4", "label": "setup()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "vector": [8, 2, 0.9452, 0.0137, 2, 0.83, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:If_L72_C0", "label": "if", "type": "if", "loc": [72, 73], "level": 0, "parent": null, "vector": [4, 0, 0.9932, 0.0274, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n Main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L73_C2", "label": "Main()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_6:If_L72_C0", "vector": [8, 1, 1.0, 0.0137, 1, 0.05, 0.0, 16, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Main", "arg_names": [], "import_names": [], "rhs_call_name": "Main", "annotation": ""}, "snippet": " Main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Return_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Import_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Import_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_6:If_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_6:Expr_L73_C2"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl except: from cgi import parse_qsl import oauth2 as oauth REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' consumer_key = None consumer_secret = None if consumer_key is None or consumer_secret is None: print 'You need to edit this script and provide values for the' print 'consumer_key and also consumer_secret.' print '' print 'The values you need come from Twitter - you need to register' print 'as a developer your "application". This is needed only until' print 'Twitter finishes the idea they have of a way to allow open-source' print 'based libraries to have a token that can be used to generate a' print 'one-time use key that will allow the library to make the request' print 'on your behalf.' print '' sys.exit(1) signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) oauth_client = oauth.Client(oauth_consumer) print 'Requesting temp token from Twitter' resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET') if resp['status'] != '200': print 'Invalid respond from Twitter requesting temp token: %s' % resp['status'] else: request_token = dict(parse_qsl(content)) print '' print 'Please visit this Twitter page and retrieve the pincode to be used' print 'in the next step to obtaining an Authentication Token:' print '' print '%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']) print '' pincode = raw_input('Pincode? ') token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret']) token.set_verifier(pincode) print '' print 'Generating and signing request for an access token' print '' oauth_client = oauth.Client(oauth_consumer, token) resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % pincode) access_token = dict(parse_qsl(content)) if resp['status'] != '200': print 'The request for a Token did not succeed: %s' % resp['status'] print access_token else: print 'Your Twitter Access Token key: %s' % access_token['oauth_token'] print ' Access Token secret: %s' % access_token['oauth_token_secret'] print ''
ajibawa-2023/Python-Code-Large/train/row_7
53
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_7:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1978, 0.011, 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_7:Import_L19_C0", "label": "sys import sys", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2088, 0.011, 0, 0.66, 0.0625, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Try_L22_C0", "label": "try", "type": "try", "loc": [22, 25], "level": 0, "parent": null, "vector": [7, 0, 0.2582, 0.044, 0, 0.66, 0.125, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from urlparse import parse_qsl\nexcept:\n from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:ImportFrom_L23_C2", "label": "from urlparse import parse_qsl", "type": "import", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:Try_L22_C0", "vector": [1, 1, 0.2527, 0.011, 1, 0.53, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from urlparse import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:ImportFrom_L25_C2", "label": "from cgi import parse_qsl", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:Try_L22_C0", "vector": [1, 1, 0.2747, 0.011, 1, 0.53, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Import_L27_C0", "label": "oauth2 import oauth", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2967, 0.011, 0, 0.66, 0.1875, 311, 0, 1, 0, 0, 311, 0, 0], "semantic": {"name": "oauth2", "arg_names": [], "import_names": ["oauth"], "rhs_call_name": "", "annotation": ""}, "snippet": "import oauth2 as oauth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L29_C0", "label": "REQUEST_TOKEN_URL =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.3187, 0.011, 0, 0.66, 0.25, 456, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REQUEST_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L30_C0", "label": "ACCESS_TOKEN_URL =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.3297, 0.011, 0, 0.66, 0.3125, 469, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ACCESS_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L31_C0", "label": "AUTHORIZATION_URL =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.3407, 0.011, 0, 0.66, 0.375, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUTHORIZATION_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L32_C0", "label": "SIGNIN_URL =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.3516, 0.011, 0, 0.66, 0.4375, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L34_C0", "label": "consumer_key =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3736, 0.011, 0, 0.66, 0.5, 353, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L35_C0", "label": "consumer_secret =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3846, 0.011, 0, 0.66, 0.5625, 734, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "label": "if", "type": "if", "loc": [38, 49], "level": 0, "parent": null, "vector": [4, 0, 0.478, 0.1319, 0, 0.66, 0.625, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if consumer_key is None or consumer_secret is None:\n print('You need to edit this script and provide values for the')\n print('consumer_key and also consumer_secret.')\n print('')\n print('The values you need come from Twitter - you need to register')\n print('as a developer your \"application\". This is needed only until')\n print('Twitter finishes the idea they have of a way to allow open-source')\n print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L39_C2", "label": "print()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4286, 0.011, 1, 0.31, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('You need to edit this script and provide values for the')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L40_C2", "label": "print()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4396, 0.011, 1, 0.31, 0.1, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('consumer_key and also consumer_secret.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L41_C2", "label": "print()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4505, 0.011, 1, 0.31, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L42_C2", "label": "print()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4615, 0.011, 1, 0.31, 0.3, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The values you need come from Twitter - you need to register')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L43_C2", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4725, 0.011, 1, 0.31, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('as a developer your \"application\". This is needed only until')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4835, 0.011, 1, 0.31, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Twitter finishes the idea they have of a way to allow open-source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L45_C2", "label": "print()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.4945, 0.011, 1, 0.31, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L46_C2", "label": "print()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.5055, 0.011, 1, 0.31, 0.7, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('one-time use key that will allow the library to make the request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L47_C2", "label": "print()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.5165, 0.011, 1, 0.31, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('on your behalf.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L48_C2", "label": "print()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.5275, 0.011, 1, 0.31, 0.9, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L49_C2", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "vector": [8, 1, 0.5385, 0.011, 1, 0.31, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L51_C0", "label": "signature_method_hmac_sha1 = SignatureMethod_HMAC_SHA1()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.5604, 0.011, 0, 0.66, 0.6875, 705, 3, 0, 0, 0, 948, 10, 1], "semantic": {"name": "signature_method_hmac_sha1", "arg_names": [], "import_names": [], "rhs_call_name": "SignatureMethod_HMAC_SHA1", "annotation": ""}, "snippet": "signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L52_C0", "label": "oauth_consumer = Consumer()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.011, 0, 0.66, 0.75, 316, 3, 2, 0, 0, 881, 10, 1], "semantic": {"name": "oauth_consumer", "arg_names": [], "import_names": [], "rhs_call_name": "Consumer", "annotation": ""}, "snippet": "oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L53_C0", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.5824, 0.011, 0, 0.66, 0.8125, 671, 3, 1, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": "oauth_client = oauth.Client(oauth_consumer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L55_C0", "label": "print()", "type": "expression", "loc": [55, 55], "level": 0, "parent": null, "vector": [8, 0, 0.6044, 0.011, 0, 0.66, 0.875, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Requesting temp token from Twitter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L57_C0", "label": "resp, content = request()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.6264, 0.011, 0, 0.66, 0.9375, 339, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": "resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "label": "if", "type": "if", "loc": [59, 90], "level": 0, "parent": null, "vector": [4, 0, 0.8187, 0.3516, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if resp['status'] != '200':\n print('Invalid respond from Twitter requesting temp token: %s' % resp['status'])\nelse:\n request_token = dict(parse_qsl(content))\n\n print('')\n print('Please visit this Twitter page and retrieve the pincode to be used')\n print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L60_C2", "label": "print()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.6593, 0.011, 1, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Invalid respond from Twitter requesting temp token: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L62_C2", "label": "request_token = dict()", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.6813, 0.011, 1, 0.49, 0.0588, 279, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " request_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L64_C2", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7033, 0.011, 1, 0.49, 0.1176, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L65_C2", "label": "print()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7143, 0.011, 1, 0.49, 0.1765, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please visit this Twitter page and retrieve the pincode to be used')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7253, 0.011, 1, 0.49, 0.2353, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L67_C2", "label": "print()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7363, 0.011, 1, 0.49, 0.2941, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L68_C2", "label": "print()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7473, 0.011, 1, 0.49, 0.3529, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L69_C2", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.7582, 0.011, 1, 0.49, 0.4118, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L71_C2", "label": "pincode = raw_input()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.7802, 0.011, 1, 0.49, 0.4706, 437, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "pincode", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " pincode = raw_input('Pincode? ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L73_C2", "label": "token = Token()", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.8022, 0.011, 1, 0.49, 0.5294, 129, 3, 2, 0, 0, 92, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "Token", "annotation": ""}, "snippet": " token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L74_C2", "label": "set_verifier()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.8132, 0.011, 1, 0.49, 0.5882, 943, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_verifier", "arg_names": [], "import_names": [], "rhs_call_name": "set_verifier", "annotation": ""}, "snippet": " token.set_verifier(pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L76_C2", "label": "print()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.8352, 0.011, 1, 0.49, 0.6471, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L77_C2", "label": "print()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.8462, 0.011, 1, 0.49, 0.7059, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Generating and signing request for an access token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L78_C2", "label": "print()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [8, 1, 0.8571, 0.011, 1, 0.49, 0.7647, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L80_C2", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.8791, 0.011, 1, 0.49, 0.8235, 671, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " oauth_client = oauth.Client(oauth_consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L81_C2", "label": "resp, content = request()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.8901, 0.011, 1, 0.49, 0.8824, 339, 3, 3, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L82_C2", "label": "access_token = dict()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [14, 1, 0.9011, 0.011, 1, 0.49, 0.9412, 797, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " access_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "label": "if", "type": "if", "loc": [84, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "vector": [4, 1, 0.956, 0.0769, 1, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp['status'] != '200':\n print('The request for a Token did not succeed: %s' % resp['status'])\n print(access_token)\n else:\n print('Your Twitter Access Token key: %s' % access_token['oauth_token'])\n print(' Access Token secret: %s' % access_token['oauth_token_secret'])\n print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L85_C4", "label": "print()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "vector": [8, 2, 0.9341, 0.011, 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('The request for a Token did not succeed: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L86_C4", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "vector": [8, 2, 0.9451, 0.011, 2, 0.3, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(access_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L88_C4", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "vector": [8, 2, 0.967, 0.011, 2, 0.3, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Your Twitter Access Token key: %s' % access_token['oauth_token'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L89_C4", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "vector": [8, 2, 0.978, 0.011, 2, 0.3, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Access Token secret: %s' % access_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "vector": [8, 2, 0.989, 0.011, 2, 0.3, 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_7:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:ImportFrom_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:ImportFrom_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_7:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_7:Expr_L90_C4"}]
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # Assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') FLOAT_REPR = repr def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii class JSONEncoder(object): """Extensible JSON <http://json.org> encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys: _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals False=False, True=True, ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = dct.items() items.sort(key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif _skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode
ajibawa-2023/Python-Code-Large/train/row_8
230
434
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0046, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Implementation of JSONEncoder\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0023, 0, 0.66, 0.0667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0", "label": "try", "type": "try", "loc": [5, 8], "level": 0, "parent": null, "vector": [7, 0, 0.015, 0.0092, 0, 0.66, 0.1333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:ImportFrom_L6_C4", "label": "from simplejson._speedups import c_encode_basestring_ascii", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0", "vector": [1, 1, 0.0138, 0.0023, 1, 0.08, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_encode_basestring_ascii"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L8_C4", "label": "c_encode_basestring_ascii =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0", "vector": [14, 1, 0.0184, 0.0023, 1, 0.08, 0.0, 485, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L9_C0", "label": "try", "type": "try", "loc": [9, 12], "level": 0, "parent": null, "vector": [7, 0, 0.0242, 0.0092, 0, 0.66, 0.2, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:ImportFrom_L10_C4", "label": "from simplejson._speedups import c_make_encoder", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L9_C0", "vector": [1, 1, 0.023, 0.0023, 1, 0.75, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L12_C4", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L9_C0", "vector": [14, 1, 0.0276, 0.0023, 1, 0.75, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L14_C0", "label": "ESCAPE = compile()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0323, 0.0023, 0, 0.66, 0.2667, 562, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L15_C0", "label": "ESCAPE_ASCII = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0346, 0.0023, 0, 0.66, 0.3333, 214, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE_ASCII", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L16_C0", "label": "HAS_UTF8 = compile()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0369, 0.0023, 0, 0.66, 0.4, 954, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "HAS_UTF8", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "HAS_UTF8 = re.compile(r'[\\x80-\\xff]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L17_C0", "label": "ESCAPE_DCT =", "type": "assigned_variable", "loc": [17, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0484, 0.0207, 0, 0.66, 0.4667, 404, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ESCAPE_DCT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_DCT = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L26_C0", "label": "for i", "type": "for", "loc": [26, 27], "level": 0, "parent": null, "vector": [6, 0, 0.0611, 0.0046, 0, 0.66, 0.5333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L27_C4", "label": "setdefault()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L26_C0", "vector": [8, 1, 0.0622, 0.0023, 1, 0.55, 0.0, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L30_C0", "label": "INFINITY = float()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.0691, 0.0023, 0, 0.66, 0.6, 681, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "INFINITY", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "INFINITY = float('1e66666')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L31_C0", "label": "FLOAT_REPR =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0023, 0, 0.66, 0.6667, 39, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLOAT_REPR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLOAT_REPR = repr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "label": "encode_basestring", "type": "function", "loc": [33, 39], "level": 0, "parent": null, "vector": [2, 0, 0.0829, 0.0161, 0, 0.66, 0.7333, 207, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "encode_basestring", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_basestring(s):\n \"\"\"Return a JSON representation of a Python string\n\n \"\"\"\n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "vector": [8, 1, 0.0806, 0.0069, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L37_C4", "label": "replace", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "vector": [2, 1, 0.0864, 0.0046, 1, 0.9, 0.5, 293, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L37_C4", "vector": [13, 2, 0.0876, 0.0023, 2, 0.21, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "vector": [13, 1, 0.0899, 0.0023, 1, 0.9, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "label": "py_encode_basestring_ascii", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.1198, 0.0484, 0, 0.66, 0.8, 438, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "py_encode_basestring_ascii", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_encode_basestring_ascii(s):\n \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "vector": [8, 1, 0.1014, 0.0069, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L46_C4", "label": "if", "type": "if", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "vector": [4, 1, 0.1071, 0.0046, 1, 0.77, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L47_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L46_C4", "vector": [14, 2, 0.1083, 0.0023, 2, 0.49, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4", "label": "replace", "type": "function", "loc": [48, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "vector": [2, 1, 0.1256, 0.0323, 1, 0.77, 0.6667, 293, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L49_C8", "label": "s = group()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4", "vector": [14, 2, 0.1129, 0.0023, 2, 0.07, 0.0, 553, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "label": "try", "type": "try", "loc": [50, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4", "vector": [7, 2, 0.1279, 0.0276, 2, 0.07, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "vector": [13, 3, 0.1175, 0.0023, 3, 0.69, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[s]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L53_C12", "label": "n = ord()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "vector": [14, 3, 0.1221, 0.0023, 3, 0.69, 0.0, 773, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " n = ord(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "vector": [4, 3, 0.1325, 0.0184, 3, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair\n n -= 0x10000\n s1 = 0xd800 | ((n >> 10) & 0x3ff)\n s2 = 0xdc00 | (n & 0x3ff)\n return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L55_C16", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "vector": [13, 4, 0.1267, 0.0023, 4, 0.36, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L59_C16", "label": "s1 =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "vector": [14, 4, 0.1359, 0.0023, 4, 0.36, 0.3333, 745, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s1 = 0xd800 | ((n >> 10) & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L60_C16", "label": "s2 =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "vector": [14, 4, 0.1382, 0.0023, 4, 0.36, 0.6667, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L61_C16", "label": "return", "type": "return", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "vector": [13, 4, 0.1406, 0.0023, 4, 0.36, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "vector": [13, 1, 0.1429, 0.0023, 1, 0.77, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + str(ESCAPE_ASCII.sub(replace, s)) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L65_C0", "label": "encode_basestring_ascii =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.1498, 0.0023, 0, 0.66, 0.8667, 105, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "label": "JSONEncoder", "type": "class", "loc": [67, 256], "level": 0, "parent": null, "vector": [3, 0, 0.3721, 0.4378, 0, 0.66, 0.9333, 228, 0, 6, 0, 0, 186, 0, 18], "semantic": {"name": "JSONEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONEncoder(object):\n \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [8, 1, 0.1878, 0.0645, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+\n | dict | object |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L96_C4", "label": "item_separator =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [14, 1, 0.2212, 0.0023, 1, 0.44, 0.1667, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = ', '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L97_C4", "label": "key_separator =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [14, 1, 0.2235, 0.0023, 1, 0.44, 0.3333, 294, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_separator = ': '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [2, 1, 0.2903, 0.1313, 1, 0.44, 0.5, 555, 0, 10, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "sort_keys", "indent", "separators", "encoding", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, skipkeys=False, ensure_ascii=True,\n check_circular=True, allow_nan=True, sort_keys=False,\n indent=None, separators=None, encoding='utf-8', default=None):\n \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [8, 2, 0.28, 0.0968, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped.\n\n If ensure_ascii is True, the output is guaranteed to be str\n objects with all incoming unicode characters escaped. If"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L144_C8", "label": "self.skipkeys =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3318, 0.0023, 2, 0.18, 0.1111, 853, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.skipkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.skipkeys = skipkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L145_C8", "label": "self.ensure_ascii =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3341, 0.0023, 2, 0.18, 0.2222, 255, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ensure_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ensure_ascii = ensure_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L146_C8", "label": "self.check_circular =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3364, 0.0023, 2, 0.18, 0.3333, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.check_circular", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_circular = check_circular"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L147_C8", "label": "self.allow_nan =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3387, 0.0023, 2, 0.18, 0.4444, 507, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_nan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_nan = allow_nan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L148_C8", "label": "self.sort_keys =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.341, 0.0023, 2, 0.18, 0.5556, 911, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sort_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sort_keys = sort_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L149_C8", "label": "self.indent =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3433, 0.0023, 2, 0.18, 0.6667, 771, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.indent = indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L150_C8", "label": "if", "type": "if", "loc": [150, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [4, 2, 0.3468, 0.0046, 2, 0.18, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if separators is not None:\n self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L151_C12", "label": "assign", "type": "assigned_variable", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L150_C8", "vector": [14, 3, 0.3479, 0.0023, 3, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [4, 2, 0.3514, 0.0046, 2, 0.18, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default is not None:\n self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L153_C12", "label": "self.default =", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L152_C8", "vector": [14, 3, 0.3525, 0.0023, 3, 0.14, 0.0, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L154_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "vector": [14, 2, 0.3548, 0.0023, 2, 0.18, 1.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L156_C4", "label": "default", "type": "function", "loc": [156, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [2, 1, 0.3802, 0.0438, 1, 0.44, 0.6667, 977, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "default", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, o):\n \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L156_C4", "vector": [8, 2, 0.3802, 0.0392, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n\n def default(self, o):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "label": "encode", "type": "function", "loc": [176, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [2, 1, 0.4332, 0.0576, 1, 0.44, 0.8333, 623, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "encode", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, o):\n \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\"\n # This is for extremely simple cases and benchmarks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L177_C8", "label": "expression", "type": "expression", "loc": [177, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "vector": [8, 2, 0.4136, 0.0138, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8", "label": "if", "type": "if", "loc": [184, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "vector": [4, 2, 0.4343, 0.023, 2, 0.88, 0.25, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)\n if self.ensure_ascii:\n return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12", "label": "if", "type": "if", "loc": [185, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8", "vector": [4, 3, 0.4309, 0.0115, 3, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L186_C16", "label": "_encoding =", "type": "assigned_variable", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12", "vector": [14, 4, 0.4286, 0.0023, 4, 0.21, 0.0, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoding = self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L187_C16", "label": "if", "type": "if", "loc": [187, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12", "vector": [4, 4, 0.4332, 0.0069, 4, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L189_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L187_C16", "vector": [14, 5, 0.4355, 0.0023, 5, 0.03, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12", "label": "if", "type": "if", "loc": [190, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8", "vector": [4, 3, 0.4412, 0.0092, 3, 0.85, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else:\n return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L191_C16", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12", "vector": [13, 4, 0.4401, 0.0023, 4, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L193_C16", "label": "return", "type": "return", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12", "vector": [13, 4, 0.4447, 0.0023, 4, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L197_C8", "label": "chunks = iterencode()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "vector": [14, 2, 0.4539, 0.0023, 2, 0.88, 0.5, 284, 3, 2, 0, 0, 315, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " chunks = self.iterencode(o, _one_shot=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L198_C8", "label": "if", "type": "if", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "vector": [4, 2, 0.4574, 0.0046, 2, 0.88, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(chunks, (list, tuple)):\n chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L199_C12", "label": "chunks = list()", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L198_C8", "vector": [14, 3, 0.4585, 0.0023, 3, 0.45, 0.0, 284, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "vector": [13, 2, 0.4608, 0.0023, 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 ''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "label": "iterencode", "type": "function", "loc": [202, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "vector": [2, 1, 0.5276, 0.1267, 1, 0.44, 1.0, 315, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "iterencode", "arg_names": ["self", "o", "_one_shot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterencode(self, o, _one_shot=False):\n \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L203_C8", "label": "expression", "type": "expression", "loc": [203, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [8, 2, 0.477, 0.0207, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8", "label": "if", "type": "if", "loc": [212, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [4, 2, 0.4919, 0.0092, 2, 0.92, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_circular:\n markers = {}\n else:\n markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L213_C12", "label": "markers =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8", "vector": [14, 3, 0.4908, 0.0023, 3, 0.87, 0.0, 586, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L215_C12", "label": "markers =", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8", "vector": [14, 3, 0.4954, 0.0023, 3, 0.87, 1.0, 586, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8", "label": "if", "type": "if", "loc": [216, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [4, 2, 0.5012, 0.0092, 2, 0.92, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n _encoder = encode_basestring_ascii\n else:\n _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L217_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8", "vector": [14, 3, 0.5, 0.0023, 3, 0.16, 0.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L219_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8", "vector": [14, 3, 0.5046, 0.0023, 3, 0.16, 1.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L220_C8", "label": "if", "type": "if", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [4, 2, 0.5115, 0.0115, 2, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.encoding != 'utf-8':\n def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12", "label": "_encoder", "type": "function", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L220_C8", "vector": [2, 3, 0.5127, 0.0092, 3, 0.78, 0.0, 153, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_encoder", "arg_names": ["o", "_orig_encoder", "_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L222_C16", "label": "if", "type": "if", "loc": [222, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12", "vector": [4, 4, 0.5127, 0.0046, 4, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L223_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [223, 223], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L222_C16", "vector": [14, 5, 0.5138, 0.0023, 5, 0.87, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L224_C16", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12", "vector": [13, 4, 0.5161, 0.0023, 4, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "label": "floatstr", "type": "function", "loc": [226, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [2, 2, 0.5403, 0.0415, 2, 0.92, 0.6667, 122, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "floatstr", "arg_names": ["o", "allow_nan", "_repr", "_inf", "_neginf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):\n # Check for specials. Note that this type of test is processor- and/or\n # platform-specific, so do tests which don't depend on the internals.\n\n if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12", "label": "if", "type": "if", "loc": [230, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "vector": [4, 3, 0.538, 0.0184, 3, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L231_C16", "label": "text =", "type": "assigned_variable", "loc": [231, 231], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12", "vector": [14, 4, 0.5323, 0.0023, 4, 0.65, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12", "label": "if", "type": "if", "loc": [232, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12", "vector": [4, 4, 0.5403, 0.0138, 4, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L233_C16", "label": "text =", "type": "assigned_variable", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12", "vector": [14, 5, 0.5369, 0.0023, 5, 0.75, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12", "vector": [4, 5, 0.5426, 0.0092, 5, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L235_C16", "label": "text =", "type": "assigned_variable", "loc": [235, 235], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12", "vector": [14, 6, 0.5415, 0.0023, 6, 0.15, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = '-Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L237_C16", "label": "return", "type": "return", "loc": [237, 237], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12", "vector": [13, 6, 0.5461, 0.0023, 6, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L239_C12", "label": "if", "type": "if", "loc": [239, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "vector": [4, 3, 0.553, 0.0069, 3, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_nan:\n raise ValueError(\"Out of range float values are not JSON compliant: %r\"\n % (o,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L243_C12", "label": "return", "type": "return", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "vector": [13, 3, 0.5599, 0.0023, 3, 0.06, 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_8:If_L246_C8", "label": "if", "type": "if", "loc": [246, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [4, 2, 0.5772, 0.023, 2, 0.92, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:\n _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)\n else:\n _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L247_C12", "label": "_iterencode = c_make_encoder()", "type": "assigned_variable", "loc": [247, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L246_C8", "vector": [14, 3, 0.5726, 0.0092, 3, 0.28, 0.0, 136, 3, 9, 0, 0, 30, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "c_make_encoder", "annotation": ""}, "snippet": " _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L252_C12", "label": "_iterencode = _make_iterencode()", "type": "assigned_variable", "loc": [252, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L246_C8", "vector": [14, 3, 0.5841, 0.0092, 3, 0.28, 1.0, 136, 3, 10, 0, 0, 845, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "_make_iterencode", "annotation": ""}, "snippet": " _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, _one_shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "vector": [13, 2, 0.5899, 0.0023, 2, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode(o, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "label": "_make_iterencode", "type": "function", "loc": [258, 434], "level": 0, "parent": null, "vector": [2, 0, 0.7972, 0.4078, 0, 0.66, 1.0, 845, 0, 21, 1, 0, 0, 0, 50], "semantic": {"name": "_make_iterencode", "arg_names": ["markers", "_default", "_encoder", "_indent", "_floatstr", "_key_separator", "_item_separator", "_sort_keys", "_skipkeys", "_one_shot", "ValueError", "basestring", "dict", "float", "id", "int", "isinstance", "list", "long", "str", "tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\n ## HACK: hand-optimized bytecode; turn globals into locals\n ValueError=ValueError,\n basestring=basestring,\n dict=dict,\n float=float,\n id=id,\n int=int,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "label": "_iterencode_list", "type": "function", "loc": [273, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "vector": [2, 1, 0.6878, 0.1198, 1, 0.58, 0.0, 1, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "_iterencode_list", "arg_names": ["lst", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_list(lst, _current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8", "label": "if", "type": "if", "loc": [274, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [4, 2, 0.6336, 0.0069, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lst:\n yield '[]'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L275_C12", "label": "expression", "type": "expression", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8", "vector": [8, 3, 0.6336, 0.0023, 3, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '[]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L276_C12", "label": "return", "type": "return", "loc": [276, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8", "vector": [13, 3, 0.6359, 0.0023, 3, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "label": "if", "type": "if", "loc": [277, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [4, 2, 0.6429, 0.0115, 2, 0.0, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L278_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "vector": [14, 3, 0.6406, 0.0023, 3, 0.51, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(lst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L279_C12", "label": "if", "type": "if", "loc": [279, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "vector": [4, 3, 0.644, 0.0046, 3, 0.51, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L281_C12", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "vector": [14, 3, 0.6475, 0.0023, 3, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L282_C8", "label": "buf =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [14, 2, 0.6498, 0.0023, 2, 0.0, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = '['"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "label": "if", "type": "if", "loc": [283, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [4, 2, 0.6601, 0.0184, 2, 0.0, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n separator = _item_separator + newline_indent\n buf += newline_indent\n else:\n newline_indent = None\n separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L285_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "vector": [14, 3, 0.6567, 0.0023, 3, 0.26, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L286_C12", "label": "separator =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "vector": [14, 3, 0.659, 0.0023, 3, 0.26, 0.3333, 539, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L289_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "vector": [14, 3, 0.6659, 0.0023, 3, 0.26, 0.6667, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L290_C12", "label": "separator =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "vector": [14, 3, 0.6682, 0.0023, 3, 0.26, 1.0, 539, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L291_C8", "label": "first =", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [14, 2, 0.6705, 0.0023, 2, 0.0, 0.5, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8", "label": "for value", "type": "for", "loc": [292, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [6, 2, 0.7028, 0.0622, 2, 0.0, 0.625, 441, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value in lst:\n if first:\n first = False\n else:\n buf = separator\n if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12", "label": "if", "type": "if", "loc": [293, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8", "vector": [4, 3, 0.6786, 0.0092, 3, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L294_C16", "label": "first =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12", "vector": [14, 4, 0.6774, 0.0023, 4, 0.34, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L296_C16", "label": "buf =", "type": "assigned_variable", "loc": [296, 296], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12", "vector": [14, 4, 0.682, 0.0023, 4, 0.34, 1.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12", "label": "if", "type": "if", "loc": [297, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8", "vector": [4, 3, 0.7085, 0.0507, 3, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L298_C16", "label": "expression", "type": "expression", "loc": [298, 298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12", "vector": [8, 4, 0.6866, 0.0023, 4, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12", "label": "if", "type": "if", "loc": [299, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12", "vector": [4, 4, 0.7108, 0.0461, 4, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L300_C16", "label": "expression", "type": "expression", "loc": [300, 300], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12", "vector": [8, 5, 0.6912, 0.0023, 5, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12", "label": "if", "type": "if", "loc": [301, 318], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12", "vector": [4, 5, 0.7131, 0.0415, 5, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L302_C16", "label": "expression", "type": "expression", "loc": [302, 302], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12", "vector": [8, 6, 0.6959, 0.0023, 6, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12", "label": "if", "type": "if", "loc": [303, 318], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12", "vector": [4, 6, 0.7154, 0.0369, 6, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L304_C16", "label": "expression", "type": "expression", "loc": [304, 304], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12", "vector": [8, 7, 0.7005, 0.0023, 7, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12", "label": "if", "type": "if", "loc": [305, 318], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12", "vector": [4, 7, 0.7177, 0.0323, 7, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L306_C16", "label": "expression", "type": "expression", "loc": [306, 306], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12", "vector": [8, 8, 0.7051, 0.0023, 8, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "label": "if", "type": "if", "loc": [307, 318], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12", "vector": [4, 8, 0.72, 0.0276, 8, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L308_C16", "label": "expression", "type": "expression", "loc": [308, 308], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "vector": [8, 9, 0.7097, 0.0023, 9, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L310_C16", "label": "expression", "type": "expression", "loc": [310, 310], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "vector": [8, 9, 0.7143, 0.0023, 9, 0.53, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16", "label": "if", "type": "if", "loc": [311, 316], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "vector": [4, 9, 0.7224, 0.0138, 9, 0.53, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L312_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [312, 312], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16", "vector": [14, 10, 0.7189, 0.0023, 10, 0.25, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16", "label": "if", "type": "if", "loc": [313, 316], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16", "vector": [4, 10, 0.7247, 0.0092, 10, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L314_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [314, 314], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16", "vector": [14, 11, 0.7235, 0.0023, 11, 0.35, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L316_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [316, 316], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16", "vector": [14, 11, 0.7281, 0.0023, 11, 0.35, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L317_C16", "label": "for chunk", "type": "for", "loc": [317, 318], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "vector": [6, 9, 0.7316, 0.0046, 9, 0.53, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L318_C20", "label": "expression", "type": "expression", "loc": [318, 318], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L317_C16", "vector": [8, 10, 0.7327, 0.0023, 10, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L319_C8", "label": "if", "type": "if", "loc": [319, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [4, 2, 0.7373, 0.0069, 2, 0.0, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L321_C12", "label": "expression", "type": "expression", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L319_C8", "vector": [8, 3, 0.7396, 0.0023, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [8, 2, 0.7419, 0.0023, 2, 0.0, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L323_C8", "label": "if", "type": "if", "loc": [323, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "vector": [4, 2, 0.7454, 0.0046, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "label": "_iterencode_dict", "type": "function", "loc": [326, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "vector": [2, 1, 0.8376, 0.1751, 1, 0.58, 0.3333, 301, 0, 2, 0, 0, 0, 0, 23], "semantic": {"name": "_iterencode_dict", "arg_names": ["dct", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_dict(dct, _current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8", "label": "if", "type": "if", "loc": [327, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.7558, 0.0069, 2, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dct:\n yield '{}'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L328_C12", "label": "expression", "type": "expression", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8", "vector": [8, 3, 0.7558, 0.0023, 3, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L329_C12", "label": "return", "type": "return", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8", "vector": [13, 3, 0.7581, 0.0023, 3, 0.14, 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_8:If_L330_C8", "label": "if", "type": "if", "loc": [330, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.765, 0.0115, 2, 0.74, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L331_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "vector": [14, 3, 0.7627, 0.0023, 3, 0.04, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(dct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L332_C12", "label": "if", "type": "if", "loc": [332, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "vector": [4, 3, 0.7661, 0.0046, 3, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L334_C12", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "vector": [14, 3, 0.7696, 0.0023, 3, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [8, 2, 0.7719, 0.0023, 2, 0.74, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "label": "if", "type": "if", "loc": [336, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.7823, 0.0184, 2, 0.74, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n item_separator = _item_separator + newline_indent\n yield newline_indent\n else:\n newline_indent = None\n item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L338_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "vector": [14, 3, 0.7788, 0.0023, 3, 0.97, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L339_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "vector": [14, 3, 0.7811, 0.0023, 3, 0.97, 0.25, 330, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L340_C12", "label": "expression", "type": "expression", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "vector": [8, 3, 0.7834, 0.0023, 3, 0.97, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L342_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "vector": [14, 3, 0.788, 0.0023, 3, 0.97, 0.75, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L343_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [343, 343], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "vector": [14, 3, 0.7903, 0.0023, 3, 0.97, 1.0, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L344_C8", "label": "first =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [14, 2, 0.7926, 0.0023, 2, 0.74, 0.4444, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "label": "if", "type": "if", "loc": [345, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.7995, 0.0115, 2, 0.74, 0.5556, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _sort_keys:\n items = dct.items()\n items.sort(key=lambda kv: kv[0])\n else:\n items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L346_C12", "label": "items = items()", "type": "assigned_variable", "loc": [346, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "vector": [14, 3, 0.7972, 0.0023, 3, 0.69, 0.0, 339, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " items = dct.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L347_C12", "label": "sort()", "type": "expression", "loc": [347, 347], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "vector": [8, 3, 0.7995, 0.0023, 3, 0.69, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " items.sort(key=lambda kv: kv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L349_C12", "label": "items = iteritems()", "type": "assigned_variable", "loc": [349, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "vector": [14, 3, 0.8041, 0.0023, 3, 0.69, 1.0, 339, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "label": "for key, value", "type": "for", "loc": [350, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [6, 2, 0.8583, 0.106, 2, 0.74, 0.6667, 839, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in items:\n if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L351_C12", "label": "if", "type": "if", "loc": [351, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "vector": [4, 3, 0.8283, 0.0415, 3, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12", "label": "if", "type": "if", "loc": [355, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L351_C12", "vector": [4, 4, 0.8329, 0.0323, 4, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L356_C16", "label": "key = _floatstr()", "type": "assigned_variable", "loc": [356, 356], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12", "vector": [14, 5, 0.8203, 0.0023, 5, 0.03, 0.0, 230, 3, 1, 0, 0, 185, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "_floatstr", "annotation": ""}, "snippet": " key = _floatstr(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12", "label": "if", "type": "if", "loc": [357, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12", "vector": [4, 5, 0.8353, 0.0276, 5, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L358_C16", "label": "key = str()", "type": "assigned_variable", "loc": [358, 358], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12", "vector": [14, 6, 0.8249, 0.0023, 6, 0.04, 0.0, 230, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12", "label": "if", "type": "if", "loc": [359, 368], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12", "vector": [4, 6, 0.8376, 0.023, 6, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L360_C16", "label": "key =", "type": "assigned_variable", "loc": [360, 360], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12", "vector": [14, 7, 0.8295, 0.0023, 7, 0.91, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12", "label": "if", "type": "if", "loc": [361, 368], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12", "vector": [4, 7, 0.8399, 0.0184, 7, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L362_C16", "label": "key =", "type": "assigned_variable", "loc": [362, 362], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12", "vector": [14, 8, 0.8341, 0.0023, 8, 0.49, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12", "label": "if", "type": "if", "loc": [363, 368], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12", "vector": [4, 8, 0.8422, 0.0138, 8, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L364_C16", "label": "key =", "type": "assigned_variable", "loc": [364, 364], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12", "vector": [14, 9, 0.8387, 0.0023, 9, 0.79, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L365_C12", "label": "if", "type": "if", "loc": [365, 368], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12", "vector": [4, 9, 0.8445, 0.0092, 9, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12", "label": "if", "type": "if", "loc": [369, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "vector": [4, 3, 0.8537, 0.0092, 3, 0.17, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L370_C16", "label": "first =", "type": "assigned_variable", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12", "vector": [14, 4, 0.8525, 0.0023, 4, 0.13, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L372_C16", "label": "expression", "type": "expression", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12", "vector": [8, 4, 0.8571, 0.0023, 4, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L373_C12", "label": "expression", "type": "expression", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "vector": [8, 3, 0.8594, 0.0023, 3, 0.17, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L374_C12", "label": "expression", "type": "expression", "loc": [374, 374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "vector": [8, 3, 0.8618, 0.0023, 3, 0.17, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _key_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12", "label": "if", "type": "if", "loc": [375, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "vector": [4, 3, 0.8871, 0.0484, 3, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield _encoder(value)\n elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L376_C16", "label": "expression", "type": "expression", "loc": [376, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12", "vector": [8, 4, 0.8664, 0.0023, 4, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12", "label": "if", "type": "if", "loc": [377, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12", "vector": [4, 4, 0.8894, 0.0438, 4, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L378_C16", "label": "expression", "type": "expression", "loc": [378, 378], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12", "vector": [8, 5, 0.871, 0.0023, 5, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12", "label": "if", "type": "if", "loc": [379, 395], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12", "vector": [4, 5, 0.8917, 0.0392, 5, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L380_C16", "label": "expression", "type": "expression", "loc": [380, 380], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12", "vector": [8, 6, 0.8756, 0.0023, 6, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12", "label": "if", "type": "if", "loc": [381, 395], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12", "vector": [4, 6, 0.894, 0.0346, 6, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L382_C16", "label": "expression", "type": "expression", "loc": [382, 382], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12", "vector": [8, 7, 0.8802, 0.0023, 7, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12", "label": "if", "type": "if", "loc": [383, 395], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12", "vector": [4, 7, 0.8963, 0.03, 7, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L384_C16", "label": "expression", "type": "expression", "loc": [384, 384], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12", "vector": [8, 8, 0.8848, 0.0023, 8, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "label": "if", "type": "if", "loc": [385, 395], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12", "vector": [4, 8, 0.8986, 0.0253, 8, 0.53, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L386_C16", "label": "expression", "type": "expression", "loc": [386, 386], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "vector": [8, 9, 0.8894, 0.0023, 9, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16", "label": "if", "type": "if", "loc": [388, 393], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "vector": [4, 9, 0.8998, 0.0138, 9, 0.4, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L389_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [389, 389], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16", "vector": [14, 10, 0.8963, 0.0023, 10, 0.82, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16", "label": "if", "type": "if", "loc": [390, 393], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16", "vector": [4, 10, 0.9021, 0.0092, 10, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L391_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [391, 391], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16", "vector": [14, 11, 0.9009, 0.0023, 11, 0.96, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L393_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [393, 393], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16", "vector": [14, 11, 0.9055, 0.0023, 11, 0.96, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L394_C16", "label": "for chunk", "type": "for", "loc": [394, 395], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "vector": [6, 9, 0.909, 0.0046, 9, 0.4, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L395_C20", "label": "expression", "type": "expression", "loc": [395, 395], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L394_C16", "vector": [8, 10, 0.9101, 0.0023, 10, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L396_C8", "label": "if", "type": "if", "loc": [396, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.9147, 0.0069, 2, 0.74, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L398_C12", "label": "expression", "type": "expression", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L396_C8", "vector": [8, 3, 0.9171, 0.0023, 3, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L399_C8", "label": "expression", "type": "expression", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [8, 2, 0.9194, 0.0023, 2, 0.74, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L400_C8", "label": "if", "type": "if", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "vector": [4, 2, 0.9228, 0.0046, 2, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L403_C4", "label": "_iterencode", "type": "function", "loc": [403, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "vector": [2, 1, 0.962, 0.0691, 1, 0.58, 0.6667, 136, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "_iterencode", "arg_names": ["o", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode(o, _current_indent_level):\n if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8", "label": "if", "type": "if", "loc": [404, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L403_C4", "vector": [4, 2, 0.9631, 0.0668, 2, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L405_C12", "label": "expression", "type": "expression", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8", "vector": [8, 3, 0.9332, 0.0023, 3, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8", "label": "if", "type": "if", "loc": [406, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8", "vector": [4, 3, 0.9654, 0.0622, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L407_C12", "label": "expression", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8", "vector": [8, 4, 0.9378, 0.0023, 4, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8", "label": "if", "type": "if", "loc": [408, 432], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8", "vector": [4, 4, 0.9677, 0.0576, 4, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L409_C12", "label": "expression", "type": "expression", "loc": [409, 409], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8", "vector": [8, 5, 0.9424, 0.0023, 5, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8", "label": "if", "type": "if", "loc": [410, 432], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8", "vector": [4, 5, 0.97, 0.053, 5, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L411_C12", "label": "expression", "type": "expression", "loc": [411, 411], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8", "vector": [8, 6, 0.947, 0.0023, 6, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8", "label": "if", "type": "if", "loc": [412, 432], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8", "vector": [4, 6, 0.9724, 0.0484, 6, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L413_C12", "label": "expression", "type": "expression", "loc": [413, 413], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8", "vector": [8, 7, 0.9516, 0.0023, 7, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8", "label": "if", "type": "if", "loc": [414, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8", "vector": [4, 7, 0.9747, 0.0438, 7, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L415_C12", "label": "expression", "type": "expression", "loc": [415, 415], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8", "vector": [8, 8, 0.9562, 0.0023, 8, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8", "label": "if", "type": "if", "loc": [416, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8", "vector": [4, 8, 0.977, 0.0392, 8, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L417_C12", "label": "for chunk", "type": "for", "loc": [417, 418], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8", "vector": [6, 9, 0.962, 0.0046, 9, 0.42, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L418_C16", "label": "expression", "type": "expression", "loc": [418, 418], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L417_C12", "vector": [8, 10, 0.9631, 0.0023, 10, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "label": "if", "type": "if", "loc": [419, 432], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8", "vector": [4, 9, 0.9804, 0.0323, 9, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L420_C12", "label": "for chunk", "type": "for", "loc": [420, 421], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "vector": [6, 10, 0.9689, 0.0046, 10, 0.86, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L421_C16", "label": "expression", "type": "expression", "loc": [421, 421], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L420_C12", "vector": [8, 11, 0.97, 0.0023, 11, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "label": "if", "type": "if", "loc": [423, 427], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "vector": [4, 10, 0.9793, 0.0115, 10, 0.86, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L424_C16", "label": "markerid = id()", "type": "assigned_variable", "loc": [424, 424], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "vector": [14, 11, 0.977, 0.0023, 11, 0.95, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L425_C16", "label": "if", "type": "if", "loc": [425, 426], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "vector": [4, 11, 0.9804, 0.0046, 11, 0.95, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L427_C16", "label": "assign", "type": "assigned_variable", "loc": [427, 427], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "vector": [14, 11, 0.9839, 0.0023, 11, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L428_C12", "label": "o = _default()", "type": "assigned_variable", "loc": [428, 428], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "vector": [14, 10, 0.9862, 0.0023, 10, 0.86, 0.5, 926, 3, 1, 0, 0, 99, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "_default", "annotation": ""}, "snippet": " o = _default(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:For_L429_C12", "label": "for chunk", "type": "for", "loc": [429, 430], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "vector": [6, 10, 0.9896, 0.0046, 10, 0.86, 0.75, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L430_C16", "label": "expression", "type": "expression", "loc": [430, 430], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:For_L429_C12", "vector": [8, 11, 0.9908, 0.0023, 11, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:If_L431_C12", "label": "if", "type": "if", "loc": [431, 432], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "vector": [4, 10, 0.9942, 0.0046, 10, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L434_C4", "label": "return", "type": "return", "loc": [434, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "vector": [13, 1, 1.0, 0.0023, 1, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L186_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L187_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L189_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L222_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L223_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L296_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L300_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L302_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L304_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L306_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L308_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L310_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L312_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L314_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L316_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L317_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L317_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L318_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L334_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L343_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L351_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L356_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L358_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L360_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L362_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L364_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L380_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L382_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L384_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L386_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L389_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L391_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L393_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L394_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L394_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L395_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L396_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L400_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L403_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L409_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L417_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L418_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L420_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L420_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L421_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L424_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L425_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L427_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Assign_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:For_L429_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:For_L429_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Expr_L430_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_8:If_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_8:Return_L434_C4"}]
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import simplejson as json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson as json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson as json >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) >>> print '\n'.join([l.rstrip() for l in s.splitlines()]) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson as json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import simplejson as json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> import decimal >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1') True Specializing JSON object encoding:: >>> import simplejson as json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError("%r is not JSON serializable" % (o,)) ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ __version__ = '2.0.7' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] from decoder import JSONDecoder from encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8', default=None, ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, **kw) def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN, null, true, false. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(encoding=encoding, **kw).decode(s)
ajibawa-2023/Python-Code-Large/train/row_10
41
316
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1582, 0.3133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility with Python 2.4 and Python 2.5 and (currently) has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L100_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.3165, 0.0032, 0, 0.66, 0.1, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '2.0.7'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L101_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [101, 104], "level": 0, "parent": null, "vector": [14, 0, 0.3244, 0.0127, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'dump', 'dumps', 'load', 'loads',\n 'JSONDecoder', 'JSONEncoder',\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:ImportFrom_L106_C0", "label": "from decoder import JSONDecoder", "type": "import", "loc": [106, 106], "level": 0, "parent": null, "vector": [1, 0, 0.3354, 0.0032, 0, 0.66, 0.3, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["JSONDecoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:ImportFrom_L107_C0", "label": "from encoder import JSONEncoder", "type": "import", "loc": [107, 107], "level": 0, "parent": null, "vector": [1, 0, 0.3386, 0.0032, 0, 0.66, 0.4, 672, 0, 1, 0, 0, 672, 0, 0], "semantic": {"name": "encoder", "arg_names": [], "import_names": ["JSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from encoder import JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L109_C0", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [109, 118], "level": 0, "parent": null, "vector": [14, 0, 0.3592, 0.0316, 0, 0.66, 0.5, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": "_default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "label": "dump", "type": "function", "loc": [120, 179], "level": 0, "parent": null, "vector": [2, 0, 0.4731, 0.1899, 0, 0.66, 0.6, 952, 0, 12, 0, 0, 0, 0, 4], "semantic": {"name": "dump", "arg_names": ["obj", "fp", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L123_C4", "label": "expression", "type": "expression", "loc": [123, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "vector": [8, 1, 0.4509, 0.1266, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "label": "if", "type": "if", "loc": [164, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "vector": [4, 1, 0.5364, 0.038, 1, 0.76, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n iterable = _default_encoder.iterencode(obj)\n else:\n if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L168_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "vector": [14, 2, 0.5316, 0.0032, 2, 0.21, 0.0, 444, 3, 1, 0, 0, 315, 10, 1], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = _default_encoder.iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L170_C8", "label": "if", "type": "if", "loc": [170, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "vector": [4, 2, 0.5396, 0.0063, 2, 0.21, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L171_C12", "label": "cls =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L170_C8", "vector": [14, 3, 0.5411, 0.0032, 3, 0.8, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L172_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "vector": [14, 2, 0.5491, 0.0127, 2, 0.21, 1.0, 444, 3, 1, 0, 0, 315, 10, 2], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding,\n default=default, **kw).iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:For_L178_C4", "label": "for chunk", "type": "for", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "vector": [6, 1, 0.5649, 0.0063, 1, 0.76, 1.0, 637, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in iterable:\n fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L179_C8", "label": "write()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:For_L178_C4", "vector": [8, 2, 0.5665, 0.0032, 2, 0.7, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "label": "dumps", "type": "function", "loc": [182, 235], "level": 0, "parent": null, "vector": [2, 0, 0.6598, 0.1709, 0, 0.66, 0.7, 160, 0, 11, 1, 0, 0, 0, 3], "semantic": {"name": "dumps", "arg_names": ["obj", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L185_C4", "label": "expression", "type": "expression", "loc": [185, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "vector": [8, 1, 0.644, 0.1203, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the return value will be a\n ``unicode`` instance subject to normal Python ``str`` to ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "vector": [4, 1, 0.7152, 0.0158, 1, 0.85, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L224_C4", "vector": [13, 2, 0.7215, 0.0032, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L229_C4", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "vector": [4, 1, 0.7263, 0.0063, 1, 0.85, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L230_C8", "label": "cls =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L229_C4", "vector": [14, 2, 0.7278, 0.0032, 2, 0.53, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "vector": [13, 1, 0.7373, 0.0158, 1, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(\n skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding, default=default,\n **kw).encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L238_C0", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [238, 238], "level": 0, "parent": null, "vector": [14, 0, 0.7532, 0.0032, 0, 0.66, 0.8, 340, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": "_default_decoder = JSONDecoder(encoding=None, object_hook=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L241_C0", "label": "load", "type": "function", "loc": [241, 265], "level": 0, "parent": null, "vector": [2, 0, 0.8006, 0.0791, 0, 0.66, 0.9, 37, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "load", "arg_names": ["fp", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L241_C0", "vector": [8, 1, 0.7975, 0.0601, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are\n not allowed, and should be wrapped with\n ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L241_C0", "vector": [13, 1, 0.8339, 0.0127, 1, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_constant=parse_constant, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "label": "loads", "type": "function", "loc": [268, 316], "level": 0, "parent": null, "vector": [2, 0, 0.9241, 0.1551, 0, 0.66, 1.0, 88, 0, 8, 1, 0, 0, 0, 3], "semantic": {"name": "loads", "arg_names": ["s", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L270_C4", "label": "expression", "type": "expression", "loc": [270, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [8, 1, 0.9035, 0.1013, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)\n are not allowed and should be decoded to ``unicode`` first.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L302_C4", "label": "if", "type": "if", "loc": [302, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9604, 0.0127, 1, 0.0, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None and not kw):\n return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L302_C4", "vector": [13, 2, 0.9652, 0.0032, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9699, 0.0063, 1, 0.0, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L307_C8", "label": "cls =", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L306_C4", "vector": [14, 2, 0.9715, 0.0032, 2, 0.43, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9763, 0.0063, 1, 0.0, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_hook is not None:\n kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L309_C8", "label": "assign", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L308_C4", "vector": [14, 2, 0.9778, 0.0032, 2, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L310_C4", "label": "if", "type": "if", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9826, 0.0063, 1, 0.0, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_float is not None:\n kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L311_C8", "label": "assign", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L310_C4", "vector": [14, 2, 0.9842, 0.0032, 2, 0.26, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L312_C4", "label": "if", "type": "if", "loc": [312, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9889, 0.0063, 1, 0.0, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_int is not None:\n kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L313_C8", "label": "assign", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L312_C4", "vector": [14, 2, 0.9905, 0.0032, 2, 0.82, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:If_L314_C4", "label": "if", "type": "if", "loc": [314, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [4, 1, 0.9953, 0.0063, 1, 0.0, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_constant is not None:\n kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L315_C8", "label": "assign", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:If_L314_C4", "vector": [14, 2, 0.9968, 0.0032, 2, 0.51, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "vector": [13, 1, 1.0, 0.0032, 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 cls(encoding=encoding, **kw).decode(s)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:For_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:For_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:If_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:If_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_10:Return_L316_C4"}]
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match encoding = context.encoding strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration if nextchar == '"': return parse_string(string, idx + 1, encoding, strict) elif nextchar == '{': return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration return _scan_once make_scanner = c_make_scanner or py_make_scanner
ajibawa-2023/Python-Code-Large/train/row_12
48
65
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_12:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"JSON token scanner\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.0846, 0.0615, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:ImportFrom_L5_C4", "label": "from simplejson._speedups import c_make_scanner", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L4_C0", "vector": [1, 1, 0.0769, 0.0154, 1, 0.66, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_scanner"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_scanner as c_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L7_C4", "label": "c_make_scanner =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L4_C0", "vector": [14, 1, 0.1077, 0.0154, 1, 0.66, 0.0, 400, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L9_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1385, 0.0154, 0, 0.66, 0.5, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['make_scanner']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L11_C0", "label": "NUMBER_RE = compile()", "type": "assigned_variable", "loc": [11, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1846, 0.0462, 0, 0.66, 0.6667, 566, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "NUMBER_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "NUMBER_RE = re.compile(\n r'(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?',\n (re.VERBOSE | re.MULTILINE | re.DOTALL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "label": "py_make_scanner", "type": "function", "loc": [15, 63], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.7538, 0, 0.66, 0.8333, 796, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "py_make_scanner", "arg_names": ["context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_make_scanner(context):\n parse_object = context.parse_object\n parse_array = context.parse_array\n parse_string = context.parse_string\n match_number = NUMBER_RE.match\n encoding = context.encoding\n strict = context.strict\n parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L16_C4", "label": "parse_object =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.71, 0.0, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_object = context.parse_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L17_C4", "label": "parse_array =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.71, 0.0909, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_array = context.parse_array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L18_C4", "label": "parse_string =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.71, 0.1818, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_string = context.parse_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L19_C4", "label": "match_number =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.2923, 0.0154, 1, 0.71, 0.2727, 264, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_number = NUMBER_RE.match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L20_C4", "label": "encoding =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3077, 0.0154, 1, 0.71, 0.3636, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = context.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L21_C4", "label": "strict =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3231, 0.0154, 1, 0.71, 0.4545, 697, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = context.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L22_C4", "label": "parse_float =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3385, 0.0154, 1, 0.71, 0.5455, 475, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_float", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L23_C4", "label": "parse_int =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3538, 0.0154, 1, 0.71, 0.6364, 31, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_int", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_int = context.parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L24_C4", "label": "parse_constant =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3692, 0.0154, 1, 0.71, 0.7273, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_constant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_constant = context.parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L25_C4", "label": "object_hook =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [14, 1, 0.3846, 0.0154, 1, 0.71, 0.8182, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_hook = context.object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "label": "_scan_once", "type": "function", "loc": [27, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [2, 1, 0.6769, 0.5385, 1, 0.71, 0.9091, 221, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_scan_once", "arg_names": ["string", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _scan_once(string, idx):\n try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration\n\n if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "vector": [7, 2, 0.4538, 0.0615, 2, 0.87, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L29_C12", "label": "nextchar =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L28_C8", "vector": [14, 3, 0.4462, 0.0154, 3, 0.84, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nextchar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nextchar = string[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8", "label": "if", "type": "if", "loc": [33, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "vector": [4, 2, 0.5923, 0.1846, 2, 0.87, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)\n elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L34_C12", "label": "return", "type": "return", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8", "vector": [13, 3, 0.5231, 0.0154, 3, 0.72, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8", "label": "if", "type": "if", "loc": [35, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8", "vector": [4, 3, 0.6077, 0.1538, 3, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L36_C12", "label": "return", "type": "return", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8", "vector": [13, 4, 0.5538, 0.0154, 4, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8", "label": "if", "type": "if", "loc": [37, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8", "vector": [4, 4, 0.6231, 0.1231, 4, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L38_C12", "label": "return", "type": "return", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8", "vector": [13, 5, 0.5846, 0.0154, 5, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_array((string, idx + 1), _scan_once)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8", "vector": [4, 5, 0.6385, 0.0923, 5, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8", "vector": [13, 6, 0.6154, 0.0154, 6, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8", "label": "if", "type": "if", "loc": [41, 44], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8", "vector": [4, 6, 0.6538, 0.0615, 6, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L42_C12", "label": "return", "type": "return", "loc": [42, 42], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8", "vector": [13, 7, 0.6462, 0.0154, 7, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L43_C8", "label": "if", "type": "if", "loc": [43, 44], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8", "vector": [4, 7, 0.6692, 0.0308, 7, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L44_C12", "label": "return", "type": "return", "loc": [44, 44], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L43_C8", "vector": [13, 8, 0.6769, 0.0154, 8, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L46_C8", "label": "m = match_number()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "vector": [14, 2, 0.7077, 0.0154, 2, 0.87, 0.6667, 711, 3, 2, 0, 0, 264, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match_number", "annotation": ""}, "snippet": " m = match_number(string, idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "label": "if", "type": "if", "loc": [47, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "vector": [4, 2, 0.8308, 0.2308, 2, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m is not None:\n integer, frac, exp = m.groups()\n if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)\n return res, m.end()\n elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L48_C12", "label": "integer, frac, exp = groups()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "vector": [14, 3, 0.7385, 0.0154, 3, 0.8, 0.0, 563, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "integer, frac, exp", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " integer, frac, exp = m.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12", "label": "if", "type": "if", "loc": [49, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "vector": [4, 3, 0.7769, 0.0615, 3, 0.8, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L50_C16", "label": "res = parse_float()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12", "vector": [14, 4, 0.7692, 0.0154, 4, 0.15, 0.0, 413, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_float", "annotation": ""}, "snippet": " res = parse_float(integer + (frac or '') + (exp or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L52_C16", "label": "res = parse_int()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12", "vector": [14, 4, 0.8, 0.0154, 4, 0.15, 1.0, 413, 3, 1, 0, 0, 31, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_int", "annotation": ""}, "snippet": " res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "vector": [13, 3, 0.8154, 0.0154, 3, 0.8, 0.6667, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res, m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "vector": [4, 3, 0.8846, 0.1231, 3, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\n return parse_constant('NaN'), idx + 3\n elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8", "vector": [13, 4, 0.8462, 0.0154, 4, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('NaN'), idx + 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8", "label": "if", "type": "if", "loc": [56, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8", "vector": [4, 4, 0.9, 0.0923, 4, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8", "vector": [13, 5, 0.8769, 0.0154, 5, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('Infinity'), idx + 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8", "vector": [4, 5, 0.9154, 0.0615, 5, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:If_L58_C8", "vector": [13, 6, 0.9077, 0.0154, 6, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('-Infinity'), idx + 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "vector": [13, 1, 0.9692, 0.0154, 1, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _scan_once"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L65_C0", "label": "make_scanner =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0154, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "make_scanner = c_make_scanner or py_make_scanner"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_12:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_12:Return_L63_C4"}]
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twitter consumer key --consumer-secret : the twitter consumer secret --access-key : the twitter access token key --access-secret : the twitter access token secret --encoding : the character set encoding used in input strings, e.g. "utf-8". [optional] Documentation: If either of the command line flags are not present, the environment variables TWEETUSERNAME and TWEETPASSWORD will then be checked for your consumer_key or consumer_secret, respectively. If neither the command line flags nor the enviroment variables are present, the .tweetrc file, if it exists, can be used to set the default consumer_key and consumer_secret. The file should contain the following three lines, replacing *consumer_key* with your consumer key, and *consumer_secret* with your consumer secret: A skeletal .tweetrc file: [Tweet] consumer_key: *consumer_key* consumer_secret: *consumer_password* access_key: *access_key* access_secret: *access_password* ''' def PrintUsageAndExit(): print USAGE sys.exit(2) def GetConsumerKeyEnv(): return os.environ.get("TWEETUSERNAME", None) def GetConsumerSecretEnv(): return os.environ.get("TWEETPASSWORD", None) def GetAccessKeyEnv(): return os.environ.get("TWEETACCESSKEY", None) def GetAccessSecretEnv(): return os.environ.get("TWEETACCESSSECRET", None) class TweetRc(object): def __init__(self): self._config = None def GetConsumerKey(self): return self._GetOption('consumer_key') def GetConsumerSecret(self): return self._GetOption('consumer_secret') def GetAccessKey(self): return self._GetOption('access_key') def GetAccessSecret(self): return self._GetOption('access_secret') def _GetOption(self, option): try: return self._GetConfig().get('Tweet', option) except: return None def _GetConfig(self): if not self._config: self._config = ConfigParser.ConfigParser() self._config.read(os.path.expanduser('~/.tweetrc')) return self._config def main(): try: shortflags = 'h' longflags = ['help', 'consumer-key=', 'consumer-secret=', 'access-key=', 'access-secret=', 'encoding='] opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: PrintUsageAndExit() consumer_keyflag = None consumer_secretflag = None access_keyflag = None access_secretflag = None encoding = None for o, a in opts: if o in ("-h", "--help"): PrintUsageAndExit() if o in ("--consumer-key"): consumer_keyflag = a if o in ("--consumer-secret"): consumer_secretflag = a if o in ("--access-key"): access_keyflag = a if o in ("--access-secret"): access_secretflag = a if o in ("--encoding"): encoding = a message = ' '.join(args) if not message: PrintUsageAndExit() rc = TweetRc() consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey() consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret() access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey() access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret() if not consumer_key or not consumer_secret or not access_key or not access_secret: PrintUsageAndExit() api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_key, access_token_secret=access_secret, input_encoding=encoding) try: status = api.PostUpdate(message) except UnicodeDecodeError: print "Your message could not be encoded. Perhaps it contains non-ASCII characters? " print "Try explicitly specifying the encoding with the --encoding flag" sys.exit(2) print "%s just posted: %s" % (status.user.name, status.text) if __name__ == "__main__": main()
ajibawa-2023/Python-Code-Large/train/row_14
82
141
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0213, 0.0071, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Post a message to twitter'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L5_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.0355, 0.0071, 0, 0.66, 0.0667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'dewitt@google.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Import_L7_C0", "label": "ConfigParser import ConfigParser", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0071, 0, 0.66, 0.1333, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "ConfigParser", "arg_names": [], "import_names": ["ConfigParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ConfigParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Import_L8_C0", "label": "getopt import getopt", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0567, 0.0071, 0, 0.66, 0.2, 588, 0, 1, 0, 0, 588, 0, 0], "semantic": {"name": "getopt", "arg_names": [], "import_names": ["getopt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getopt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0071, 0, 0.66, 0.2667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Import_L10_C0", "label": "sys import sys", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0709, 0.0071, 0, 0.66, 0.3333, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Import_L11_C0", "label": "twitter import twitter", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0071, 0, 0.66, 0.4, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "twitter", "arg_names": [], "import_names": ["twitter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import twitter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L14_C0", "label": "USAGE =", "type": "assigned_variable", "loc": [14, 47], "level": 0, "parent": null, "vector": [14, 0, 0.2163, 0.2411, 0, 0.66, 0.4667, 952, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "USAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USAGE = '''Usage: tweet [options] message\n\n This script posts a message to Twitter.\n\n Options:\n\n -h --help : print this help\n --consumer-key : the twitter consumer key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L49_C0", "label": "PrintUsageAndExit", "type": "function", "loc": [49, 51], "level": 0, "parent": null, "vector": [2, 0, 0.3546, 0.0213, 0, 0.66, 0.5333, 314, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PrintUsageAndExit():\n print(USAGE)\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L50_C2", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L49_C0", "vector": [8, 1, 0.3546, 0.0071, 1, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(USAGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L51_C2", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L49_C0", "vector": [8, 1, 0.3617, 0.0071, 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": " sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L53_C0", "label": "GetConsumerKeyEnv", "type": "function", "loc": [53, 54], "level": 0, "parent": null, "vector": [2, 0, 0.3794, 0.0142, 0, 0.66, 0.6, 551, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerKeyEnv():\n return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L54_C2", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L53_C0", "vector": [13, 1, 0.383, 0.0071, 1, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L56_C0", "label": "GetConsumerSecretEnv", "type": "function", "loc": [56, 57], "level": 0, "parent": null, "vector": [2, 0, 0.4007, 0.0142, 0, 0.66, 0.6667, 650, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerSecretEnv():\n return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L56_C0", "vector": [13, 1, 0.4043, 0.0071, 1, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L59_C0", "label": "GetAccessKeyEnv", "type": "function", "loc": [59, 60], "level": 0, "parent": null, "vector": [2, 0, 0.422, 0.0142, 0, 0.66, 0.7333, 932, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessKeyEnv():\n return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L59_C0", "vector": [13, 1, 0.4255, 0.0071, 1, 0.92, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L62_C0", "label": "GetAccessSecretEnv", "type": "function", "loc": [62, 63], "level": 0, "parent": null, "vector": [2, 0, 0.4433, 0.0142, 0, 0.66, 0.8, 325, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessSecretEnv():\n return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L62_C0", "vector": [13, 1, 0.4468, 0.0071, 1, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "label": "TweetRc", "type": "class", "loc": [65, 91], "level": 0, "parent": null, "vector": [3, 0, 0.5532, 0.1915, 0, 0.66, 0.8667, 61, 0, 7, 0, 0, 186, 0, 9], "semantic": {"name": "TweetRc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TweetRc(object):\n def __init__(self):\n self._config = None\n\n def GetConsumerKey(self):\n return self._GetOption('consumer_key')\n\n def GetConsumerSecret(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L66_C2", "label": "__init__", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.4716, 0.0142, 1, 0.62, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L67_C4", "label": "self._config =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L66_C2", "vector": [14, 2, 0.4752, 0.0071, 2, 0.37, 0.0, 311, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L69_C2", "label": "GetConsumerKey", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.4929, 0.0142, 1, 0.62, 0.1667, 101, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerKey(self):\n return self._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L69_C2", "vector": [13, 2, 0.4965, 0.0071, 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 self._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L72_C2", "label": "GetConsumerSecret", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.5142, 0.0142, 1, 0.62, 0.3333, 743, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerSecret(self):\n return self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L72_C2", "vector": [13, 2, 0.5177, 0.0071, 2, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L75_C2", "label": "GetAccessKey", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.5355, 0.0142, 1, 0.62, 0.5, 392, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessKey(self):\n return self._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L75_C2", "vector": [13, 2, 0.539, 0.0071, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L78_C2", "label": "GetAccessSecret", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.5567, 0.0142, 1, 0.62, 0.6667, 686, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessSecret(self):\n return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L79_C4", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L78_C2", "vector": [13, 2, 0.5603, 0.0071, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L81_C2", "label": "_GetOption", "type": "function", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.5887, 0.0355, 1, 0.62, 0.8333, 808, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_GetOption", "arg_names": ["self", "option"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetOption(self, option):\n try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4", "label": "try", "type": "try", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L81_C2", "vector": [7, 2, 0.5922, 0.0284, 2, 0.34, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L83_C6", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4", "vector": [13, 3, 0.5887, 0.0071, 3, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetConfig().get('Tweet', option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L85_C6", "label": "return", "type": "return", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4", "vector": [13, 3, 0.6028, 0.0071, 3, 0.81, 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_14:FunctionDef_L87_C2", "label": "_GetConfig", "type": "function", "loc": [87, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "vector": [2, 1, 0.6312, 0.0355, 1, 0.62, 1.0, 33, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_GetConfig", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetConfig(self):\n if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))\n return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4", "label": "if", "type": "if", "loc": [88, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L87_C2", "vector": [4, 2, 0.6312, 0.0213, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L89_C6", "label": "self._config = ConfigParser()", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4", "vector": [14, 3, 0.6312, 0.0071, 3, 0.37, 0.0, 311, 3, 0, 0, 0, 272, 10, 1], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "ConfigParser", "annotation": ""}, "snippet": " self._config = ConfigParser.ConfigParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L90_C6", "label": "read()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4", "vector": [8, 3, 0.6383, 0.0071, 3, 0.37, 1.0, 453, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L87_C2", "vector": [13, 2, 0.6454, 0.0071, 2, 0.18, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "label": "main", "type": "function", "loc": [93, 138], "level": 0, "parent": null, "vector": [2, 0, 0.8191, 0.3262, 0, 0.66, 0.9333, 624, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "label": "try", "type": "try", "loc": [94, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [7, 1, 0.6879, 0.0496, 1, 0.7, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L95_C4", "label": "shortflags =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "vector": [14, 2, 0.6738, 0.0071, 2, 0.98, 0.0, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "shortflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shortflags = 'h'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L96_C4", "label": "longflags =", "type": "assigned_variable", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "vector": [14, 2, 0.6844, 0.0142, 2, 0.98, 0.5, 745, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "longflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L98_C4", "label": "opts, args = gnu_getopt()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "vector": [14, 2, 0.695, 0.0071, 2, 0.98, 1.0, 616, 3, 3, 0, 0, 712, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "gnu_getopt", "annotation": ""}, "snippet": " opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L100_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "vector": [8, 2, 0.7092, 0.0071, 2, 0.98, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L101_C2", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.7163, 0.0071, 1, 0.7, 0.0588, 74, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L102_C2", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.7234, 0.0071, 1, 0.7, 0.1176, 178, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L103_C2", "label": "access_keyflag =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.7305, 0.0071, 1, 0.7, 0.1765, 450, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L104_C2", "label": "access_secretflag =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.7376, 0.0071, 1, 0.7, 0.2353, 83, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L105_C2", "label": "encoding =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.7447, 0.0071, 1, 0.7, 0.2941, 325, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "label": "for o, a", "type": "for", "loc": [106, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [6, 1, 0.7943, 0.0922, 1, 0.7, 0.3529, 736, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for o, a in opts:\n if o in (\"-h\", \"--help\"):\n PrintUsageAndExit()\n if o in (\"--consumer-key\"):\n consumer_keyflag = a\n if o in (\"--consumer-secret\"):\n consumer_secretflag = a\n if o in (\"--access-key\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L107_C4", "label": "if", "type": "if", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.7624, 0.0142, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"-h\", \"--help\"):\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L108_C6", "label": "PrintUsageAndExit()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L107_C4", "vector": [8, 3, 0.766, 0.0071, 3, 0.43, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L109_C4", "label": "if", "type": "if", "loc": [109, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.7766, 0.0142, 2, 0.72, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-key\"):\n consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L110_C6", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L109_C4", "vector": [14, 3, 0.7801, 0.0071, 3, 0.72, 0.0, 74, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L111_C4", "label": "if", "type": "if", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.7908, 0.0142, 2, 0.72, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-secret\"):\n consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L112_C6", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L111_C4", "vector": [14, 3, 0.7943, 0.0071, 3, 0.15, 0.0, 178, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.805, 0.0142, 2, 0.72, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-key\"):\n access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L114_C6", "label": "access_keyflag =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L113_C4", "vector": [14, 3, 0.8085, 0.0071, 3, 0.88, 0.0, 450, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.8191, 0.0142, 2, 0.72, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-secret\"):\n access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L116_C6", "label": "access_secretflag =", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L115_C4", "vector": [14, 3, 0.8227, 0.0071, 3, 0.1, 0.0, 83, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L117_C4", "label": "if", "type": "if", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "vector": [4, 2, 0.8333, 0.0142, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--encoding\"):\n encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L118_C6", "label": "encoding =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L117_C4", "vector": [14, 3, 0.8369, 0.0071, 3, 0.81, 0.0, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L119_C2", "label": "message = join()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.844, 0.0071, 1, 0.7, 0.4118, 635, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " message = ' '.join(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L120_C2", "label": "if", "type": "if", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [4, 1, 0.8546, 0.0142, 1, 0.7, 0.4706, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not message:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L121_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L120_C2", "vector": [8, 2, 0.8582, 0.0071, 2, 0.39, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L122_C2", "label": "rc = TweetRc()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.8652, 0.0071, 1, 0.7, 0.5294, 401, 3, 0, 0, 0, 61, 10, 1], "semantic": {"name": "rc", "arg_names": [], "import_names": [], "rhs_call_name": "TweetRc", "annotation": ""}, "snippet": " rc = TweetRc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L123_C2", "label": "consumer_key =", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.8723, 0.0071, 1, 0.7, 0.5882, 353, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L124_C2", "label": "consumer_secret =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.8794, 0.0071, 1, 0.7, 0.6471, 734, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L125_C2", "label": "access_key =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.8865, 0.0071, 1, 0.7, 0.7059, 200, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L126_C2", "label": "access_secret =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.8936, 0.0071, 1, 0.7, 0.7647, 171, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L127_C2", "label": "if", "type": "if", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [4, 1, 0.9043, 0.0142, 1, 0.7, 0.8235, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer_key or not consumer_secret or not access_key or not access_secret:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L128_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L127_C2", "vector": [8, 2, 0.9078, 0.0071, 2, 0.15, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L129_C2", "label": "api = Api()", "type": "assigned_variable", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [14, 1, 0.922, 0.0213, 1, 0.7, 0.8824, 976, 3, 5, 0, 0, 192, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "Api", "annotation": ""}, "snippet": " api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret,\n access_token_key=access_key, access_token_secret=access_secret,\n input_encoding=encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "label": "try", "type": "try", "loc": [132, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [7, 1, 0.9539, 0.0426, 1, 0.7, 0.9412, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n status = api.PostUpdate(message)\n except UnicodeDecodeError:\n print(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")\n print(\"Try explicitly specifying the encoding with the --encoding flag\")\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L133_C4", "label": "status = PostUpdate()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "vector": [14, 2, 0.9433, 0.0071, 2, 0.77, 0.0, 699, 3, 1, 0, 0, 880, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "PostUpdate", "annotation": ""}, "snippet": " status = api.PostUpdate(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L135_C4", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "vector": [8, 2, 0.9574, 0.0071, 2, 0.77, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L136_C4", "label": "print()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "vector": [8, 2, 0.9645, 0.0071, 2, 0.77, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Try explicitly specifying the encoding with the --encoding flag\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L137_C4", "label": "exit()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "vector": [8, 2, 0.9716, 0.0071, 2, 0.77, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L138_C2", "label": "print()", "type": "expression", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "vector": [8, 1, 0.9787, 0.0071, 1, 0.7, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"%s just posted: %s\" % (status.user.name, status.text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:If_L140_C0", "label": "if", "type": "if", "loc": [140, 141], "level": 0, "parent": null, "vector": [4, 0, 0.9965, 0.0142, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L141_C2", "label": "main()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_14:If_L140_C0", "vector": [8, 1, 1.0, 0.0071, 1, 0.0, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L89_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L90_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L110_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L112_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L116_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L118_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:If_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L138_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_14:If_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_14:Expr_L141_C2"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A class that defines the default URL Shortener. TinyURL is provided as the default and as an example. ''' import urllib # Change History # # 2010-05-16 # TinyURL example and the idea for this comes from a bug filed by # acolorado with patch provided by ghills. Class implementation # was done by bear. # # Issue 19 http://code.google.com/p/python-twitter/issues/detail?id=19 # class ShortenURL(object): '''Helper class to make URL Shortener calls if/when required''' def __init__(self, userid=None, password=None): '''Instantiate a new ShortenURL object Args: userid: userid for any required authorization call [optional] password: password for any required authorization call [optional] ''' self.userid = userid self.password = password def Shorten(self, longURL): '''Call TinyURL API and returned shortened URL result Args: longURL: URL string to shorten Returns: The shortened URL as a string Note: longURL is required and no checks are made to ensure completeness ''' result = None f = urllib.urlopen("http://tinyurl.com/api-create.php?url=%s" % longURL) try: result = f.read() finally: f.close() return result
ajibawa-2023/Python-Code-Large/train/row_15
16
71
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 20], "level": 0, "parent": null, "vector": [8, 0, 0.2606, 0.0563, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''A class that defines the default URL Shortener.\n\nTinyURL is provided as the default and as an example.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Import_L22_C0", "label": "urllib import urllib", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.3099, 0.0141, 0, 0.66, 0.5, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "label": "ShortenURL", "type": "class", "loc": [36, 71], "level": 0, "parent": null, "vector": [3, 0, 0.7535, 0.507, 0, 0.66, 1.0, 365, 0, 2, 0, 0, 186, 0, 3], "semantic": {"name": "ShortenURL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ShortenURL(object):\n '''Helper class to make URL Shortener calls if/when required'''\n def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "vector": [8, 1, 0.5211, 0.0141, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Helper class to make URL Shortener calls if/when required'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "label": "__init__", "type": "function", "loc": [38, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "vector": [2, 1, 0.6056, 0.1549, 1, 0.4, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "userid", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "vector": [8, 2, 0.6127, 0.0845, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L47_C8", "label": "self.userid =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "vector": [14, 2, 0.662, 0.0141, 2, 0.15, 0.5, 677, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.userid = userid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L48_C8", "label": "self.password =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "vector": [14, 2, 0.6761, 0.0141, 2, 0.15, 1.0, 902, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.password = password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "label": "Shorten", "type": "function", "loc": [50, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "vector": [2, 1, 0.8521, 0.3099, 1, 0.4, 1.0, 862, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "Shorten", "arg_names": ["self", "longURL"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Shorten(self,\n longURL):\n '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "vector": [8, 2, 0.8028, 0.1549, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:\n The shortened URL as a string\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L64_C8", "label": "result =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "vector": [14, 2, 0.9014, 0.0141, 2, 0.05, 0.25, 51, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L65_C8", "label": "f = urlopen()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "vector": [14, 2, 0.9155, 0.0141, 2, 0.05, 0.5, 899, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " f = urllib.urlopen(\"http://tinyurl.com/api-create.php?url=%s\" % longURL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8", "label": "try", "type": "try", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "vector": [7, 2, 0.9507, 0.0563, 2, 0.05, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result = f.read()\n finally:\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L67_C12", "label": "result = read()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8", "vector": [14, 3, 0.9437, 0.0141, 3, 0.73, 0.0, 51, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " result = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L69_C12", "label": "close()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8", "vector": [8, 3, 0.9718, 0.0141, 3, 0.73, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_15:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "vector": [13, 2, 1.0, 0.0141, 2, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_15:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_15:Return_L71_C8"}]
maxVf = 200 # Generating the header head = """// Copyright qiuc12@gmail.com // This file is generated autmatically by python. DONT MODIFY IT! #pragma once #include <OleAuto.h> class FakeDispatcher; HRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...); extern "C" void DualProcessCommandWrap(); class FakeDispatcherBase : public IDispatch { private:""" pattern = """ \tvirtual HRESULT __stdcall fv{0}(char x) {{ \t\tva_list va = &x; \t\tHRESULT ret = ProcessCommand({0}, va); \t\tva_end(va); \t\treturn ret; \t}} """ pattern = """ \tvirtual HRESULT __stdcall fv{0}();""" end = """ protected: \tconst static int kMaxVf = {0}; }}; """ f = open("FakeDispatcherBase.h", "w") f.write(head) for i in range(0, maxVf): f.write(pattern.format(i)) f.write(end.format(maxVf)) f.close() head = """; Copyright qiuc12@gmail.com ; This file is generated automatically by python. DON'T MODIFY IT! """ f = open("FakeDispatcherBase.asm", "w") f.write(head) f.write(".386\n") f.write(".model flat\n") f.write("_DualProcessCommandWrap proto\n") ObjFormat = "?fv{0}@FakeDispatcherBase@@EAGJXZ" for i in range(0, maxVf): f.write("PUBLIC " + ObjFormat.format(i) + "\n") f.write(".code\n") for i in range(0, maxVf): f.write(ObjFormat.format(i) + " proc\n") f.write(" push {0}\n".format(i)) f.write(" jmp _DualProcessCommandWrap\n") f.write(ObjFormat.format(i) + " endp\n") f.write("\nend\n") f.close()
ajibawa-2023/Python-Code-Large/train/row_18
28
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_18:Assign_L1_C0", "label": "maxVf =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0172, 0.0172, 0, 0.66, 0.0, 302, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "maxVf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "maxVf = 200"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L4_C0", "label": "head =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1466, 0.1724, 0, 0.66, 0.0476, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "head = \"\"\"// Copyright qiuc12@gmail.com\n// This file is generated autmatically by python. DONT MODIFY IT!\n\n#pragma once\n#include <OleAuto.h>\nclass FakeDispatcher;\nHRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...);\nextern \"C\" void DualProcessCommandWrap();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L15_C0", "label": "pattern =", "type": "assigned_variable", "loc": [15, 22], "level": 0, "parent": null, "vector": [14, 0, 0.319, 0.1379, 0, 0.66, 0.0952, 561, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pattern = \"\"\"\n\\tvirtual HRESULT __stdcall fv{0}(char x) {{\n\\t\\tva_list va = &x;\n\\t\\tHRESULT ret = ProcessCommand({0}, va);\n\\t\\tva_end(va);\n\\t\\treturn ret;\n\\t}}\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L23_C0", "label": "pattern =", "type": "assigned_variable", "loc": [23, 24], "level": 0, "parent": null, "vector": [14, 0, 0.4052, 0.0345, 0, 0.66, 0.1429, 561, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pattern = \"\"\"\n\\tvirtual HRESULT __stdcall fv{0}();\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L26_C0", "label": "end =", "type": "assigned_variable", "loc": [26, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4914, 0.1034, 0, 0.66, 0.1905, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "end = \"\"\"\nprotected:\n\\tconst static int kMaxVf = {0};\n\n}};\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L32_C0", "label": "f = open()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.5517, 0.0172, 0, 0.66, 0.2381, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"FakeDispatcherBase.h\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L33_C0", "label": "write()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.569, 0.0172, 0, 0.66, 0.2857, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(head)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:For_L35_C0", "label": "for i", "type": "for", "loc": [35, 36], "level": 0, "parent": null, "vector": [6, 0, 0.6121, 0.0345, 0, 0.66, 0.3333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(pattern.format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L36_C4", "label": "write()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L35_C0", "vector": [8, 1, 0.6207, 0.0172, 1, 0.85, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(pattern.format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L38_C0", "label": "write()", "type": "expression", "loc": [38, 38], "level": 0, "parent": null, "vector": [8, 0, 0.6552, 0.0172, 0, 0.66, 0.381, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(end.format(maxVf))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L39_C0", "label": "close()", "type": "expression", "loc": [39, 39], "level": 0, "parent": null, "vector": [8, 0, 0.6724, 0.0172, 0, 0.66, 0.4286, 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_18:Assign_L40_C0", "label": "head =", "type": "assigned_variable", "loc": [40, 42], "level": 0, "parent": null, "vector": [14, 0, 0.7069, 0.0517, 0, 0.66, 0.4762, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "head = \"\"\"; Copyright qiuc12@gmail.com\n; This file is generated automatically by python. DON'T MODIFY IT!\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L43_C0", "label": "f = open()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.7414, 0.0172, 0, 0.66, 0.5238, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"FakeDispatcherBase.asm\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L44_C0", "label": "write()", "type": "expression", "loc": [44, 44], "level": 0, "parent": null, "vector": [8, 0, 0.7586, 0.0172, 0, 0.66, 0.5714, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(head)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L45_C0", "label": "write()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.7759, 0.0172, 0, 0.66, 0.619, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".386\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L46_C0", "label": "write()", "type": "expression", "loc": [46, 46], "level": 0, "parent": null, "vector": [8, 0, 0.7931, 0.0172, 0, 0.66, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".model flat\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L47_C0", "label": "write()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.8103, 0.0172, 0, 0.66, 0.7143, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\"_DualProcessCommandWrap proto\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Assign_L48_C0", "label": "ObjFormat =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.8276, 0.0172, 0, 0.66, 0.7619, 675, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ObjFormat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ObjFormat = \"?fv{0}@FakeDispatcherBase@@EAGJXZ\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:For_L49_C0", "label": "for i", "type": "for", "loc": [49, 50], "level": 0, "parent": null, "vector": [6, 0, 0.8534, 0.0345, 0, 0.66, 0.8095, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(\"PUBLIC \" + ObjFormat.format(i) + \"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L50_C4", "label": "write()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L49_C0", "vector": [8, 1, 0.8621, 0.0172, 1, 0.4, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\"PUBLIC \" + ObjFormat.format(i) + \"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L51_C0", "label": "write()", "type": "expression", "loc": [51, 51], "level": 0, "parent": null, "vector": [8, 0, 0.8793, 0.0172, 0, 0.66, 0.8571, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".code\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "label": "for i", "type": "for", "loc": [52, 56], "level": 0, "parent": null, "vector": [6, 0, 0.931, 0.0862, 0, 0.66, 0.9048, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(ObjFormat.format(i) + \" proc\\n\")\n f.write(\" push {0}\\n\".format(i))\n f.write(\" jmp _DualProcessCommandWrap\\n\")\n f.write(ObjFormat.format(i) + \" endp\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L53_C4", "label": "write()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "vector": [8, 1, 0.9138, 0.0172, 1, 0.36, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(ObjFormat.format(i) + \" proc\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L54_C4", "label": "write()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "vector": [8, 1, 0.931, 0.0172, 1, 0.36, 0.3333, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\" push {0}\\n\".format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L55_C4", "label": "write()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "vector": [8, 1, 0.9483, 0.0172, 1, 0.36, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\" jmp _DualProcessCommandWrap\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L56_C4", "label": "write()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "vector": [8, 1, 0.9655, 0.0172, 1, 0.36, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(ObjFormat.format(i) + \" endp\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L57_C0", "label": "write()", "type": "expression", "loc": [57, 57], "level": 0, "parent": null, "vector": [8, 0, 0.9828, 0.0172, 0, 0.66, 0.9524, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\"\\nend\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L58_C0", "label": "close()", "type": "expression", "loc": [58, 58], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0172, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_18:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_18:Expr_L56_C4"}]
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: Error.py # Purpose: error exception class # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 30/04/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, 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 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __versionTime__ = "30/04/2008" __author__ = "Fabien Marteau <fabien.marteau@armadeus.com>" INFO = 2 WARNING = 1 ERROR = 0 class Error(Exception): """ Manage specific error attributes: message -- the message level -- the exception level """ def __init__(self,message,level): self.message = message self.level = level Exception.__init__(self,message) def __repr__(self): return self.message def __str__(self): if self.level == 0: return "[ERROR] : " + self.message elif self.level == 1: return "[WARNING]: " + self.message else: return "[INFO]: " + self.message def setLevel(self,level): self.level = int(str(level))
ajibawa-2023/Python-Code-Large/train/row_19
22
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_19:Assign_L32_C0", "label": "__doc__ =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4923, 0.0154, 0, 0.66, 0.0, 155, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__doc__ = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L33_C0", "label": "__versionTime__ =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.5077, 0.0154, 0, 0.66, 0.1667, 587, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__versionTime__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__versionTime__ = \"30/04/2008\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L34_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.5231, 0.0154, 0, 0.66, 0.3333, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L36_C0", "label": "INFO =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.5538, 0.0154, 0, 0.66, 0.5, 948, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "INFO", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INFO = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L37_C0", "label": "WARNING =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.5692, 0.0154, 0, 0.66, 0.6667, 485, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "WARNING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WARNING = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L38_C0", "label": "ERROR =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.5846, 0.0154, 0, 0.66, 0.8333, 88, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ERROR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ERROR = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "label": "Error", "type": "class", "loc": [40, 64], "level": 0, "parent": null, "vector": [3, 0, 0.8, 0.3846, 0, 0.66, 1.0, 529, 0, 4, 0, 0, 645, 0, 3], "semantic": {"name": "Error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Error(Exception):\n \"\"\" Manage specific error\n\n attributes:\n message -- the message\n level -- the exception level\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Expr_L41_C4", "label": "expression", "type": "expression", "loc": [41, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "vector": [8, 1, 0.6692, 0.0923, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Manage specific error\n\n attributes:\n message -- the message\n level -- the exception level\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "label": "__init__", "type": "function", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "vector": [2, 1, 0.7615, 0.0615, 1, 0.24, 0.25, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "message", "level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,message,level):\n self.message = message\n self.level = level\n Exception.__init__(self,message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L49_C8", "label": "self.message =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "vector": [14, 2, 0.7538, 0.0154, 2, 0.74, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L50_C8", "label": "self.level =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "vector": [14, 2, 0.7692, 0.0154, 2, 0.74, 0.5, 56, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.level = level"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Expr_L51_C8", "label": "__init__()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "vector": [8, 2, 0.7846, 0.0154, 2, 0.74, 1.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Exception.__init__(self,message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L53_C4", "label": "__repr__", "type": "function", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "vector": [2, 1, 0.8231, 0.0308, 1, 0.24, 0.5, 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 self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L54_C8", "label": "return", "type": "return", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L53_C4", "vector": [13, 2, 0.8308, 0.0154, 2, 0.98, 0.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_19:FunctionDef_L55_C4", "label": "__str__", "type": "function", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "vector": [2, 1, 0.8923, 0.1077, 1, 0.24, 0.75, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n if self.level == 0:\n return \"[ERROR] : \" + self.message\n elif self.level == 1:\n return \"[WARNING]: \" + self.message\n else:\n return \"[INFO]: \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8", "label": "if", "type": "if", "loc": [56, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L55_C4", "vector": [4, 2, 0.9, 0.0923, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.level == 0:\n return \"[ERROR] : \" + self.message\n elif self.level == 1:\n return \"[WARNING]: \" + self.message\n else:\n return \"[INFO]: \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8", "vector": [13, 3, 0.8769, 0.0154, 3, 0.84, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"[ERROR] : \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8", "vector": [4, 3, 0.9154, 0.0615, 3, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.level == 1:\n return \"[WARNING]: \" + self.message\n else:\n return \"[INFO]: \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8", "vector": [13, 4, 0.9077, 0.0154, 4, 0.54, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"[WARNING]: \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L61_C12", "label": "return", "type": "return", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8", "vector": [13, 4, 0.9385, 0.0154, 4, 0.54, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"[INFO]: \" + self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L63_C4", "label": "setLevel", "type": "function", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "vector": [2, 1, 0.9769, 0.0308, 1, 0.24, 1.0, 810, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setLevel", "arg_names": ["self", "level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setLevel(self,level):\n self.level = int(str(level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L64_C8", "label": "self.level = int()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L63_C4", "vector": [14, 2, 0.9846, 0.0154, 2, 0.13, 0.0, 56, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "self.level", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.level = int(str(level))"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Return_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_19:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_19:Assign_L64_C8"}]
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: general_test.py # Purpose: General testing program for unioc-ng # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 22/11/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, 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 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __author__ = "Fabien Marteau <fabien.marteau@armadeus.com>" import sys import os from error import Error from bootstrap import BootStrap def consoleDump(tid): while 1: sys.stdout.write(tid.read(1)) def waitForPositiveResponse(charok,error_message): response = raw_input().strip() if response != charok: raise Error(error_message,0) if __name__ == "__main__": print "********************************************" print "* This is the testing program for unioc-ng.*" print "* Version 0.1 *" print "* To ensure a good card functionning *" print "* follow the instruction. *" print "********************************************" print " Powering ..." print "* Program atmega bootstrap with JTAG" raw_input() print "* Configure fpga with GPIO ip" raw_input() print "* Branch shunts" raw_input()
ajibawa-2023/Python-Code-Large/train/row_20
26
66
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_20:Assign_L32_C0", "label": "__doc__ =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4848, 0.0152, 0, 0.66, 0.0, 155, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__doc__ = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Assign_L33_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0152, 0, 0.66, 0.125, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Import_L35_C0", "label": "sys import sys", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.5303, 0.0152, 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_20:Import_L36_C0", "label": "os import os", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0152, 0, 0.66, 0.375, 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_20:ImportFrom_L38_C0", "label": "from error import Error", "type": "import", "loc": [38, 38], "level": 0, "parent": null, "vector": [1, 0, 0.5758, 0.0152, 0, 0.66, 0.5, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "error", "arg_names": [], "import_names": ["Error"], "rhs_call_name": "", "annotation": ""}, "snippet": "from error import Error"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:ImportFrom_L39_C0", "label": "from bootstrap import BootStrap", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.5909, 0.0152, 0, 0.66, 0.625, 62, 0, 1, 0, 0, 62, 0, 0], "semantic": {"name": "bootstrap", "arg_names": [], "import_names": ["BootStrap"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bootstrap import BootStrap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L41_C0", "label": "consoleDump", "type": "function", "loc": [41, 43], "level": 0, "parent": null, "vector": [2, 0, 0.6364, 0.0455, 0, 0.66, 0.75, 693, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "consoleDump", "arg_names": ["tid"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def consoleDump(tid):\n while 1:\n sys.stdout.write(tid.read(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:While_L42_C4", "label": "while", "type": "while", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L41_C0", "vector": [5, 1, 0.6439, 0.0303, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n sys.stdout.write(tid.read(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L43_C8", "label": "write()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:While_L42_C4", "vector": [8, 2, 0.6515, 0.0152, 2, 0.37, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(tid.read(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L45_C0", "label": "waitForPositiveResponse", "type": "function", "loc": [45, 48], "level": 0, "parent": null, "vector": [2, 0, 0.7045, 0.0606, 0, 0.66, 0.875, 82, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "waitForPositiveResponse", "arg_names": ["charok", "error_message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def waitForPositiveResponse(charok,error_message):\n response = raw_input().strip()\n if response != charok:\n raise Error(error_message,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Assign_L46_C4", "label": "response = strip()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L45_C0", "vector": [14, 1, 0.697, 0.0152, 1, 0.49, 0.0, 511, 3, 0, 0, 0, 973, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " response = raw_input().strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:If_L47_C4", "label": "if", "type": "if", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L45_C0", "vector": [4, 1, 0.7197, 0.0303, 1, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if response != charok:\n raise Error(error_message,0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "label": "if", "type": "if", "loc": [51, 65], "level": 0, "parent": null, "vector": [4, 0, 0.8788, 0.2273, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n print(\"********************************************\")\n print(\"* This is the testing program for unioc-ng.*\")\n print(\"* Version 0.1 *\")\n print(\"* To ensure a good card functionning *\")\n print(\"* follow the instruction. *\")\n print(\"********************************************\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L52_C4", "label": "print()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.7879, 0.0152, 1, 0.91, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"********************************************\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L53_C4", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.803, 0.0152, 1, 0.91, 0.0833, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* This is the testing program for unioc-ng.*\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.8182, 0.0152, 1, 0.91, 0.1667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* Version 0.1 *\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.8333, 0.0152, 1, 0.91, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* To ensure a good card functionning *\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L56_C4", "label": "print()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.8485, 0.0152, 1, 0.91, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* follow the instruction. *\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L57_C4", "label": "print()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.8636, 0.0152, 1, 0.91, 0.4167, 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_20:Expr_L59_C4", "label": "print()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.8939, 0.0152, 1, 0.91, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\" Powering ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L60_C4", "label": "print()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9091, 0.0152, 1, 0.91, 0.5833, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* Program atmega bootstrap with JTAG\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L61_C4", "label": "raw_input()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9242, 0.0152, 1, 0.91, 0.6667, 821, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "raw_input", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L62_C4", "label": "print()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9394, 0.0152, 1, 0.91, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* Configure fpga with GPIO ip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L63_C4", "label": "raw_input()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9545, 0.0152, 1, 0.91, 0.8333, 821, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "raw_input", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " raw_input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9697, 0.0152, 1, 0.91, 0.9167, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"* Branch shunts\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L65_C4", "label": "raw_input()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "vector": [8, 1, 0.9848, 0.0152, 1, 0.91, 1.0, 821, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "raw_input", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " raw_input()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:While_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_20:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_20:Expr_L65_C4"}]
#! /usr/bin/python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Name: bootstrap.py # Purpose: bootstrap class used to communicate with atmega # Author: Fabien Marteau <fabien.marteau@armadeus.com> # Created: 22/11/2008 #----------------------------------------------------------------------------- # Copyright (2008) Armadeus Systems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, 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 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #----------------------------------------------------------------------------- # Revision list : # # Date By Changes # #----------------------------------------------------------------------------- __doc__ = "" __author__ = "Fabien Marteau <fabien.marteau@armadeus.com>" import sys import time import os try: import serial except ImportError: print "[ERROR]Pyserial is needed : "+\ "http://pyserial.wiki.sourceforge.net/pySerial" #exit() class BootStrap(): def __init__(self): print "TODO: init BootStrap" def put(self,address,value): """ Write a value on atmega register address : int (16bits) value : int (8bits) """ print "TODO: put %02X at %04X"%(value,address) def get(self,address): """ Read a value from atmega register address : int (16bits) return int """ print "TODO : read value at address %04X"%address
ajibawa-2023/Python-Code-Large/train/row_21
17
60
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_21:Assign_L32_C0", "label": "__doc__ =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.5333, 0.0167, 0, 0.66, 0.0, 155, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__doc__ = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Assign_L33_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.55, 0.0167, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = \"Fabien Marteau <fabien.marteau@armadeus.com>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Import_L35_C0", "label": "sys import sys", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.5833, 0.0167, 0, 0.66, 0.3333, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Import_L36_C0", "label": "time import time", "type": "import", "loc": [36, 36], "level": 0, "parent": null, "vector": [1, 0, 0.6, 0.0167, 0, 0.66, 0.5, 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_21:Import_L37_C0", "label": "os import os", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.6167, 0.0167, 0, 0.66, 0.6667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Try_L38_C0", "label": "try", "type": "try", "loc": [38, 41], "level": 0, "parent": null, "vector": [7, 0, 0.6583, 0.0667, 0, 0.66, 0.8333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import serial\nexcept ImportError:\n \"http://pyserial.wiki.sourceforge.net/pySerial\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Import_L39_C4", "label": "serial import serial", "type": "import", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:Try_L38_C0", "vector": [1, 1, 0.65, 0.0167, 1, 0.7, 0.0, 601, 0, 1, 0, 0, 601, 0, 0], "semantic": {"name": "serial", "arg_names": [], "import_names": ["serial"], "rhs_call_name": "", "annotation": ""}, "snippet": " import serial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L41_C10", "label": "expression", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:Try_L38_C0", "vector": [8, 1, 0.6833, 0.0167, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"http://pyserial.wiki.sourceforge.net/pySerial\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "label": "BootStrap", "type": "class", "loc": [44, 60], "level": 0, "parent": null, "vector": [3, 0, 0.8667, 0.2833, 0, 0.66, 1.0, 397, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "BootStrap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BootStrap():\n def __init__(self):\n print(\"TODO: init BootStrap\")\n\n def put(self,address,value):\n \"\"\" Write a value on atmega register\n address : int (16bits)\n value : int (8bits)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L45_C4", "label": "__init__", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "vector": [2, 1, 0.7583, 0.0333, 1, 0.06, 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 print(\"TODO: init BootStrap\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L45_C4", "vector": [8, 2, 0.7667, 0.0167, 2, 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(\"TODO: init BootStrap\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4", "label": "put", "type": "function", "loc": [48, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "vector": [2, 1, 0.8417, 0.1, 1, 0.06, 0.5, 636, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": ["self", "address", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def put(self,address,value):\n \"\"\" Write a value on atmega register\n address : int (16bits)\n value : int (8bits)\n \"\"\"\n print(\"TODO: put %02X at %04X\"%(value,address))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L49_C8", "label": "expression", "type": "expression", "loc": [49, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4", "vector": [8, 2, 0.8417, 0.0667, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Write a value on atmega register\n address : int (16bits)\n value : int (8bits)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L53_C8", "label": "print()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4", "vector": [8, 2, 0.8833, 0.0167, 2, 0.31, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"TODO: put %02X at %04X\"%(value,address))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4", "label": "get", "type": "function", "loc": [55, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "vector": [2, 1, 0.9583, 0.1, 1, 0.06, 1.0, 607, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self", "address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self,address):\n \"\"\" Read a value from atmega register\n address : int (16bits)\n return int\n \"\"\"\n print(\"TODO : read value at address %04X\"%address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4", "vector": [8, 2, 0.9583, 0.0667, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Read a value from atmega register\n address : int (16bits)\n return int\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L60_C8", "label": "print()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4", "vector": [8, 2, 1.0, 0.0167, 2, 0.41, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"TODO : read value at address %04X\"%address)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_21:Try_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Import_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:Try_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L41_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_21:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_21:Expr_L60_C8"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime from packet_function import * import re #regular expression from email.parser import Parser #parser for mime type ! class MSN: def __init__(self,ip, parano=False): self.local_ip = ip self.ip_packet = list() self.tcp_packet = list() self.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863 def analyse(self, data): if isIP(data): self.ip_packet = getIPPacket(data) else: return #jump early to do not slow down traffic if isUDP(self.ip_packet): udp_packet = getTCPorUDPPacket(self.ip_packet) if getDstPortUDP(udp_packet) == 53: data = udp_packet.get_data_as_string() if re.search("login.live.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for login.live.com" elif re.search("messenger.hotmail.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for messenger.hotmail.com" elif re.search("g.live.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for g.live.com" pass elif isTCP(self.ip_packet): #All packet from here are normally TCP ! self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80: return #Directly skip all http traffic to avoid useless processing on it because we are not interested in elif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2: #If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is) if self.test_https_auth(): print datetime.now().strftime("%b %d, %H:%M:%S")," Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)" elif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863: self.test_msn_connection() self.test_file_transfert() elif self.paranoid_mode: self.test_file_transfert() else: pass else: pass def test_https_auth(self): dst_ip = getDstIp(self.ip_packet) msn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177'] isMSNserver = False #determined with an nslookup should be updated if needed for ip in msn_servers: if dst_ip == ip: isMSNserver = True return isMSNserver def test_msn_connection(self): data = self.tcp_packet.get_data_as_string() if getDecFlagsValue(self.tcp_packet) == 2: print "\n",datetime.now().strftime("%b %d, %H:%M:%S")," New Connection on the TCP 1863 (which can be a MSN notification server)!" if re.match("VER 1 ",data): #VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0 #VER 1 MSNP21 if getSrcIp(self.ip_packet) == self.local_ip: print datetime.now().strftime("%b %d, %H:%M:%S")," VER Step detected Client->Server (Protocol version exchange)" else: print datetime.now().strftime("%b %d, %H:%M:%S")," VER Step detected Server->Client (Version %s used)" % (data[6:12]) elif re.match("CVR 2 ",data): #CVR 2 0x0409 winnt 6.1.0 i386 MSNMSGR 15.4.3502.0922 MSNMSGR me@hotmail.fr #VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDENCg== if getSrcIp(self.ip_packet) == self.local_ip: print datetime.now().strftime("%b %d, %H:%M:%S")," CVR Step detected Client->Server (client information sent)" infos = data[6:].split(" ") print "\t\tLocale:%s\tOS:%s(%s)\tArchi:%s\tClient:%s(%s)\tAddress:%s" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]) #Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm else: print datetime.now().strftime("%b %d, %H:%M:%S")," CVR Step detected Server->Client (Stored client information received)" elif re.match("USR 3 ",data): #USR 3 SSO I me@hotmail.fr #alert user send the initiation message of authentication infos = data.split(" ") print datetime.now().strftime("%b %d, %H:%M:%S")," USR Step detected (Initiation authentication) method:%s\tAddress:%s" % (infos[2],infos[4]) elif re.match("USR 4 ",data) and not re.match("USR 4 OK ",data): # USR 4 SSO S t=E (s for subsequent and the ticket attached) #Note SSO was not used to match because I don't know but, may other methods exists print datetime.now().strftime("%b %d, %H:%M:%S")," USR Step detected (Ticket/Token dispatching)" elif re.match("USR 4 OK ",data): #USR 4 OK me@hotmail.fr 1 0 infos= data.split(" ") print datetime.now().strftime("%b %d, %H:%M:%S")," Address %s connected and authenticated to msn !" % (infos[3]) def test_file_transfert(self): data = self.tcp_packet.get_data_as_string() new_data = ["",data] if re.search("INVITE",data):#keep only invitation message notFound = True while notFound: #separate first line from the rest and delete useless \n before new_data = new_data[1].split("\n",1) if re.search("INVITE",new_data[0]): notFound = False else: pass #First element in the array contain invitation message #The second contain mime elements #should do this, because otherwise the mime parsing fail due to the first line which is not mime if len(new_data) >= 2:#otherwise parsing below can fail due to out of range new_data[1] = re.sub(r'\r\n\r\n','\r\n',new_data[1]) mime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload) #So to get payload remove True, and it is accessible with mime_elts.get_payload() if mime_elts['EUF-GUID'] == "{5D3E02AB-6190-11D3-BBBB-00C04F795683}": #This is signature of file transfert ! if re.search("INVITE",new_data[0]):#if it was really an invitation print "\n",datetime.now().strftime("%b %d, %H:%M:%S")," File transfer invitation !" print "\t\tFrom:%s\n\t\tTo:%s" % (mime_elts['From'],mime_elts['To']) #additional tests if mime_elts['CSeq'] == "0 " or mime_elts['CSeq'] == "0":#windows live put a space other client not print "\t\tAnymore CSeq = 0 (file transfer signature)" if mime_elts['appID'] == '2': print "\t\tAnymore AppID = 2 (file transfer signature)" if mime_elts['Content-Type'] == "application/x-msnmsgr-sessionreqbody": print "\t\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\n"
ajibawa-2023/Python-Code-Large/train/row_25
90
147
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_25:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0544, 0.0068, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0068, 0, 0.66, 0.1667, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.068, 0.0068, 0, 0.66, 0.3333, 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_25:ImportFrom_L12_C0", "label": "from packet_function import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0068, 0, 0.66, 0.5, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0884, 0.0068, 0, 0.66, 0.6667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:ImportFrom_L14_C0", "label": "from email.parser import Parser", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0068, 0, 0.66, 0.8333, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "label": "MSN", "type": "class", "loc": [16, 146], "level": 0, "parent": null, "vector": [3, 0, 0.551, 0.8912, 0, 0.66, 1.0, 964, 0, 5, 0, 0, 0, 0, 90], "semantic": {"name": "MSN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MSN:\n\tdef __init__(self,ip, parano=False):\n\t\tself.local_ip = ip\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863\n\t\t\n\tdef analyse(self, data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "label": "__init__", "type": "function", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "vector": [2, 1, 0.1293, 0.034, 1, 0.6, 0.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "ip", "parano"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,ip, parano=False):\n\t\tself.local_ip = ip\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L18_C2", "label": "self.local_ip =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "vector": [14, 2, 0.1224, 0.0068, 2, 0.98, 0.0, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.local_ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.local_ip = ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L19_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "vector": [14, 2, 0.1293, 0.0068, 2, 0.98, 0.3333, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L20_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "vector": [14, 2, 0.1361, 0.0068, 2, 0.98, 0.6667, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L21_C2", "label": "self.paranoid_mode =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "vector": [14, 2, 0.1429, 0.0068, 2, 0.98, 1.0, 218, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.paranoid_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1", "label": "analyse", "type": "function", "loc": [23, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "vector": [2, 1, 0.2823, 0.2585, 1, 0.6, 0.25, 15, 0, 2, 0, 0, 0, 0, 33], "semantic": {"name": "analyse", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\telse:\n\t\t\treturn #jump early to do not slow down traffic\n\t\t\t\n\t\tif isUDP(self.ip_packet):\n\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2", "label": "if", "type": "if", "loc": [24, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1", "vector": [4, 2, 0.1735, 0.0272, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\telse:\n\t\t\treturn #jump early to do not slow down traffic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L25_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2", "vector": [14, 3, 0.1701, 0.0068, 3, 0.92, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L27_C3", "label": "return", "type": "return", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2", "vector": [13, 3, 0.1837, 0.0068, 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\t\treturn #jump early to do not slow down traffic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "label": "if", "type": "if", "loc": [29, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1", "vector": [4, 2, 0.3027, 0.2177, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 31], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isUDP(self.ip_packet):\n\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\n\t\t\tif getDstPortUDP(udp_packet) == 53:\n\t\t\t\tdata = udp_packet.get_data_as_string()\n\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L30_C3", "label": "udp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "vector": [14, 3, 0.2041, 0.0068, 3, 0.1, 0.0, 668, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "udp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3", "label": "if", "type": "if", "loc": [32, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "vector": [4, 3, 0.2415, 0.0544, 3, 0.1, 0.5, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getDstPortUDP(udp_packet) == 53:\n\t\t\t\tdata = udp_packet.get_data_as_string()\n\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L33_C4", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3", "vector": [14, 4, 0.2245, 0.0068, 4, 0.24, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\t\t\tdata = udp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4", "label": "if", "type": "if", "loc": [34, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3", "vector": [4, 4, 0.2483, 0.0408, 4, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L35_C5", "label": "print()", "type": "expression", "loc": [35, 35], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4", "vector": [8, 5, 0.2381, 0.0068, 5, 0.83, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4", "label": "if", "type": "if", "loc": [36, 39], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4", "vector": [4, 5, 0.2551, 0.0272, 5, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L37_C5", "label": "print()", "type": "expression", "loc": [37, 37], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4", "vector": [8, 6, 0.2517, 0.0068, 6, 0.03, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L38_C4", "label": "if", "type": "if", "loc": [38, 39], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4", "vector": [4, 6, 0.2619, 0.0136, 6, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L39_C5", "label": "print()", "type": "expression", "loc": [39, 39], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L38_C4", "vector": [8, 7, 0.2653, 0.0068, 7, 0.77, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2", "label": "if", "type": "if", "loc": [41, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "vector": [4, 3, 0.3435, 0.1361, 3, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif isTCP(self.ip_packet):\n\t\t\t#All packet from here are normally TCP !\n\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\n\t\t\tif self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80:\n\t\t\t\treturn\n\t\t\t\t#Directly skip all http traffic to avoid useless processing on it because we are not interested in \n\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L43_C3", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2", "vector": [14, 4, 0.2925, 0.0068, 4, 0.97, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3", "label": "if", "type": "if", "loc": [45, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2", "vector": [4, 4, 0.3503, 0.0952, 4, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80:\n\t\t\t\treturn\n\t\t\t\t#Directly skip all http traffic to avoid useless processing on it because we are not interested in \n\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\t\t#If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is)\n\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")\n\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L46_C4", "label": "return", "type": "return", "loc": [46, 46], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3", "vector": [13, 5, 0.3129, 0.0068, 5, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3", "label": "if", "type": "if", "loc": [48, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3", "vector": [4, 5, 0.3605, 0.0748, 5, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\t\t#If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is)\n\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")\n\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:\n\t\t\t\tself.test_msn_connection()\n\t\t\t\tself.test_file_transfert()\n\t\t\telif self.paranoid_mode:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L50_C4", "label": "if", "type": "if", "loc": [50, 51], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3", "vector": [4, 6, 0.3435, 0.0136, 6, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L51_C5", "label": "print()", "type": "expression", "loc": [51, 51], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L50_C4", "vector": [8, 7, 0.3469, 0.0068, 7, 0.69, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "label": "if", "type": "if", "loc": [52, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3", "vector": [4, 6, 0.3741, 0.0476, 6, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:\n\t\t\t\tself.test_msn_connection()\n\t\t\t\tself.test_file_transfert()\n\t\t\telif self.paranoid_mode:\n\t\t\t\tself.test_file_transfert()\n\t\t\telse:\n\t\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L53_C4", "label": "test_msn_connection()", "type": "expression", "loc": [53, 53], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "vector": [8, 7, 0.3605, 0.0068, 7, 0.25, 0.0, 573, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_msn_connection", "arg_names": [], "import_names": [], "rhs_call_name": "test_msn_connection", "annotation": ""}, "snippet": "\t\t\t\tself.test_msn_connection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L54_C4", "label": "test_file_transfert()", "type": "expression", "loc": [54, 54], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "vector": [8, 7, 0.3673, 0.0068, 7, 0.25, 0.5, 698, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_file_transfert", "arg_names": [], "import_names": [], "rhs_call_name": "test_file_transfert", "annotation": ""}, "snippet": "\t\t\t\tself.test_file_transfert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L55_C3", "label": "if", "type": "if", "loc": [55, 58], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "vector": [4, 7, 0.3844, 0.0272, 7, 0.25, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.paranoid_mode:\n\t\t\t\tself.test_file_transfert()\n\t\t\telse:\n\t\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L56_C4", "label": "test_file_transfert()", "type": "expression", "loc": [56, 56], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L55_C3", "vector": [8, 8, 0.381, 0.0068, 8, 0.63, 0.0, 698, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_file_transfert", "arg_names": [], "import_names": [], "rhs_call_name": "test_file_transfert", "annotation": ""}, "snippet": "\t\t\t\tself.test_file_transfert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "label": "test_https_auth", "type": "function", "loc": [62, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "vector": [2, 1, 0.449, 0.0612, 1, 0.6, 0.5, 107, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "test_https_auth", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_https_auth(self):\n\t\tdst_ip = getDstIp(self.ip_packet)\n\t\tmsn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177']\n\t\tisMSNserver = False\n\t\t#determined with an nslookup should be updated if needed\n\t\tfor ip in msn_servers:\n\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L63_C2", "label": "dst_ip = getDstIp()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "vector": [14, 2, 0.4286, 0.0068, 2, 0.13, 0.0, 161, 3, 1, 0, 0, 768, 10, 1], "semantic": {"name": "dst_ip", "arg_names": [], "import_names": [], "rhs_call_name": "getDstIp", "annotation": ""}, "snippet": "\t\tdst_ip = getDstIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L64_C2", "label": "msn_servers =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "vector": [14, 2, 0.4354, 0.0068, 2, 0.13, 0.25, 543, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "msn_servers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tmsn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L65_C2", "label": "isMSNserver =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "vector": [14, 2, 0.4422, 0.0068, 2, 0.13, 0.5, 429, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isMSNserver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tisMSNserver = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:For_L67_C2", "label": "for ip", "type": "for", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "vector": [6, 2, 0.4626, 0.0204, 2, 0.13, 0.75, 583, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor ip in msn_servers:\n\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L68_C3", "label": "if", "type": "if", "loc": [68, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:For_L67_C2", "vector": [4, 3, 0.466, 0.0136, 3, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L69_C4", "label": "isMSNserver =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L68_C3", "vector": [14, 4, 0.4694, 0.0068, 4, 0.04, 0.0, 429, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isMSNserver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "vector": [13, 2, 0.4762, 0.0068, 2, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn isMSNserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "label": "test_msn_connection", "type": "function", "loc": [72, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "vector": [2, 1, 0.6224, 0.2721, 1, 0.6, 0.75, 573, 0, 1, 0, 0, 0, 0, 38], "semantic": {"name": "test_msn_connection", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_msn_connection(self):\n\t\tdata = self.tcp_packet.get_data_as_string()\n\t\t\n\t\tif getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")\n\t\t\t\n\t\tif re.match(\"VER 1 \",data):\n\t\t\t#VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L73_C2", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "vector": [14, 2, 0.4966, 0.0068, 2, 0.27, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "vector": [4, 2, 0.5136, 0.0136, 2, 0.27, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L76_C3", "label": "print()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L75_C2", "vector": [8, 3, 0.517, 0.0068, 3, 0.79, 0.0, 535, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2", "label": "if", "type": "if", "loc": [78, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "vector": [4, 2, 0.6429, 0.2313, 2, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 0, 33], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif re.match(\"VER 1 \",data):\n\t\t\t#VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0\n\t\t\t#VER 1 MSNP21\n\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))\n\t\t\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3", "label": "if", "type": "if", "loc": [81, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2", "vector": [4, 3, 0.5612, 0.0272, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L82_C4", "label": "print()", "type": "expression", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3", "vector": [8, 4, 0.5578, 0.0068, 4, 0.42, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3", "vector": [8, 4, 0.5714, 0.0068, 4, 0.42, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2", "label": "if", "type": "if", "loc": [86, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2", "vector": [4, 3, 0.6701, 0.1769, 3, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"CVR 2 \",data):\n\t\t\t#CVR 2 0x0409 winnt 6.1.0 i386 MSNMSGR 15.4.3502.0922 MSNMSGR me@hotmail.fr \n\t\t\t#VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDENCg==\n\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")\n\t\t\t\tinfos = data[6:].split(\" \")\n\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))\n\t\t\t\t#Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "label": "if", "type": "if", "loc": [89, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2", "vector": [4, 4, 0.6259, 0.0476, 4, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")\n\t\t\t\tinfos = data[6:].split(\" \")\n\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))\n\t\t\t\t#Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Server->Client (Stored client information received)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "vector": [8, 5, 0.6122, 0.0068, 5, 0.29, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L91_C4", "label": "infos = split()", "type": "assigned_variable", "loc": [91, 91], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "vector": [14, 5, 0.619, 0.0068, 5, 0.29, 0.3333, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\tinfos = data[6:].split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L92_C4", "label": "print()", "type": "expression", "loc": [92, 92], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "vector": [8, 5, 0.6259, 0.0068, 5, 0.29, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "vector": [8, 5, 0.6463, 0.0068, 5, 0.29, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Server->Client (Stored client information received)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "label": "if", "type": "if", "loc": [97, 111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2", "vector": [4, 4, 0.7075, 0.102, 4, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 3 \",data):\n\t\t\t#USR 3 SSO I me@hotmail.fr\n\t\t\t#alert user send the initiation message of authentication\n\t\t\tinfos = data.split(\" \")\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Initiation authentication) method:%s\\tAddress:%s\" % (infos[2],infos[4]))\n\t\t\t\n\t\telif re.match(\"USR 4 \",data) and not re.match(\"USR 4 OK \",data):\n\t\t\t# USR 4 SSO S t=E (s for subsequent and the ticket attached)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L100_C3", "label": "infos = split()", "type": "assigned_variable", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "vector": [14, 5, 0.6803, 0.0068, 5, 0.61, 0.0, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\tinfos = data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L101_C3", "label": "print()", "type": "expression", "loc": [101, 101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "vector": [8, 5, 0.6871, 0.0068, 5, 0.61, 0.5, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Initiation authentication) method:%s\\tAddress:%s\" % (infos[2],infos[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2", "label": "if", "type": "if", "loc": [103, 111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "vector": [4, 5, 0.7279, 0.0612, 5, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 4 \",data) and not re.match(\"USR 4 OK \",data):\n\t\t\t# USR 4 SSO S t=E (s for subsequent and the ticket attached)\n\t\t\t#Note SSO was not used to match because I don't know but, may other methods exists\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Ticket/Token dispatching)\")\n\t\t\t\n\t\telif re.match(\"USR 4 OK \",data):\n\t\t\t#USR 4 OK me@hotmail.fr 1 0\n\t\t\tinfos= data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L106_C3", "label": "print()", "type": "expression", "loc": [106, 106], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2", "vector": [8, 6, 0.7211, 0.0068, 6, 0.43, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Ticket/Token dispatching)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2", "label": "if", "type": "if", "loc": [108, 111], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2", "vector": [4, 6, 0.7449, 0.0272, 6, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 4 OK \",data):\n\t\t\t#USR 4 OK me@hotmail.fr 1 0\n\t\t\tinfos= data.split(\" \")\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Address %s connected and authenticated to msn !\" % (infos[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L110_C3", "label": "infos = split()", "type": "assigned_variable", "loc": [110, 110], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2", "vector": [14, 7, 0.7483, 0.0068, 7, 0.1, 0.0, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\tinfos= data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L111_C3", "label": "print()", "type": "expression", "loc": [111, 111], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2", "vector": [8, 7, 0.7551, 0.0068, 7, 0.1, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Address %s connected and authenticated to msn !\" % (infos[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "label": "test_file_transfert", "type": "function", "loc": [113, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "vector": [2, 1, 0.881, 0.2313, 1, 0.6, 1.0, 698, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "test_file_transfert", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_file_transfert(self):\n\t\tdata = self.tcp_packet.get_data_as_string()\n\t\tnew_data = [\"\",data]\n\t\tif re.search(\"INVITE\",data):#keep only invitation message\n\t\t\tnotFound = True\n\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L114_C2", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "vector": [14, 2, 0.7755, 0.0068, 2, 0.12, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L115_C2", "label": "new_data =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "vector": [14, 2, 0.7823, 0.0068, 2, 0.12, 0.3333, 524, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tnew_data = [\"\",data]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2", "label": "if", "type": "if", "loc": [116, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "vector": [4, 2, 0.8129, 0.0544, 2, 0.12, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif re.search(\"INVITE\",data):#keep only invitation message\n\t\t\tnotFound = True\n\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False\n\t\telse:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L117_C3", "label": "notFound =", "type": "assigned_variable", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2", "vector": [14, 3, 0.7959, 0.0068, 3, 0.02, 0.0, 513, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "notFound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tnotFound = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3", "label": "while", "type": "while", "loc": [118, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2", "vector": [5, 3, 0.8129, 0.0272, 3, 0.02, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L119_C4", "label": "new_data = split()", "type": "assigned_variable", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3", "vector": [14, 4, 0.8095, 0.0068, 4, 0.34, 0.0, 524, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "new_data", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L120_C4", "label": "if", "type": "if", "loc": [120, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3", "vector": [4, 4, 0.8197, 0.0136, 4, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L121_C5", "label": "notFound =", "type": "assigned_variable", "loc": [121, 121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L120_C4", "vector": [14, 5, 0.8231, 0.0068, 5, 0.06, 0.0, 513, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "notFound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "label": "if", "type": "if", "loc": [128, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "vector": [4, 2, 0.932, 0.1293, 2, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(new_data) >= 2:#otherwise parsing below can fail due to out of range\n\t\t\t\n\t\t\tnew_data[1] = re.sub(r'\\r\\n\\r\\n','\\r\\n',new_data[1])\n\t\t\tmime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload)\n\t\t\t#So to get payload remove True, and it is accessible with mime_elts.get_payload()\n\t\t\t\n\t\t\t\n\t\t\tif mime_elts['EUF-GUID'] == \"{5D3E02AB-6190-11D3-BBBB-00C04F795683}\": #This is signature of file transfert !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L130_C3", "label": " = sub()", "type": "assigned_variable", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "vector": [14, 3, 0.8844, 0.0068, 3, 0.57, 0.0, 0, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": "\t\t\tnew_data[1] = re.sub(r'\\r\\n\\r\\n','\\r\\n',new_data[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L131_C3", "label": "mime_elts = parsestr()", "type": "assigned_variable", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "vector": [14, 3, 0.8912, 0.0068, 3, 0.57, 0.5, 282, 3, 2, 0, 0, 781, 10, 2], "semantic": {"name": "mime_elts", "arg_names": [], "import_names": [], "rhs_call_name": "parsestr", "annotation": ""}, "snippet": "\t\t\tmime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L135_C3", "label": "if", "type": "if", "loc": [135, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "vector": [4, 3, 0.9558, 0.0816, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif mime_elts['EUF-GUID'] == \"{5D3E02AB-6190-11D3-BBBB-00C04F795683}\": #This is signature of file transfert !\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):#if it was really an invitation\n\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")\n\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))\n\t\t\t\t\t\n\t\t\t\t\t#additional tests\n\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "label": "if", "type": "if", "loc": [136, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L135_C3", "vector": [4, 4, 0.9592, 0.0748, 4, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"INVITE\",new_data[0]):#if it was really an invitation\n\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")\n\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))\n\t\t\t\t\t\n\t\t\t\t\t#additional tests\n\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")\n\t\t\t\t\tif mime_elts['appID'] == '2':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L137_C5", "label": "print()", "type": "expression", "loc": [137, 137], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "vector": [8, 5, 0.932, 0.0068, 5, 0.56, 0.0, 535, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L138_C5", "label": "print()", "type": "expression", "loc": [138, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "vector": [8, 5, 0.9388, 0.0068, 5, 0.56, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L141_C5", "label": "if", "type": "if", "loc": [141, 142], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "vector": [4, 5, 0.9626, 0.0136, 5, 0.56, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L142_C6", "label": "print()", "type": "expression", "loc": [142, 142], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L141_C5", "vector": [8, 6, 0.966, 0.0068, 6, 0.5, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L143_C5", "label": "if", "type": "if", "loc": [143, 144], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "vector": [4, 5, 0.9762, 0.0136, 5, 0.56, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['appID'] == '2':\n\t\t\t\t\t\tprint(\"\\t\\tAnymore AppID = 2 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L144_C6", "label": "print()", "type": "expression", "loc": [144, 144], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L143_C5", "vector": [8, 6, 0.9796, 0.0068, 6, 0.09, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\t\tprint(\"\\t\\tAnymore AppID = 2 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:If_L145_C5", "label": "if", "type": "if", "loc": [145, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "vector": [4, 5, 0.9898, 0.0136, 5, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['Content-Type'] == \"application/x-msnmsgr-sessionreqbody\":\n\t\t\t\t\t\tprint(\"\\t\\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L146_C6", "label": "print()", "type": "expression", "loc": [146, 146], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_25:If_L145_C5", "vector": [8, 6, 0.9932, 0.0068, 6, 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": "\t\t\t\t\t\tprint(\"\\t\\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\\n\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L25_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L27_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L30_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L35_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L37_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L39_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L43_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L45_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L51_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L48_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L55_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:For_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:For_L67_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L68_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L76_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L81_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L100_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L110_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L108_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L111_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L117_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L116_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:While_L118_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L121_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L130_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Assign_L131_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L135_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L135_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L137_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L138_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L141_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L141_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L142_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L143_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L143_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L144_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_25:If_L145_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_25:If_L145_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_25:Expr_L146_C6"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime from packet_function import * import re #regular expression from email.parser import Parser #parser for mime type ! class MSN: def __init__(self,ip, parano=False): self.local_ip = ip self.ip_packet = list() self.tcp_packet = list() self.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863 def analyse(self, data): if isIP(data): self.ip_packet = getIPPacket(data) else: return #jump early to do not slow down traffic if isUDP(self.ip_packet): udp_packet = getTCPorUDPPacket(self.ip_packet) if getDstPortUDP(udp_packet) == 53: data = udp_packet.get_data_as_string() if re.search("login.live.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for login.live.com" elif re.search("messenger.hotmail.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for messenger.hotmail.com" elif re.search("g.live.com", data): print datetime.now().strftime("%b %d, %H:%M:%S")," DNS request for g.live.com" pass elif isTCP(self.ip_packet): #All packet from here are normally TCP ! self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80: return #Directly skip all http traffic to avoid useless processing on it because we are not interested in elif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2: #If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is) if self.test_https_auth(): print datetime.now().strftime("%b %d, %H:%M:%S")," Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)" elif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863: self.test_msn_connection() self.test_file_transfert() elif self.paranoid_mode: self.test_file_transfert() else: pass else: pass def test_https_auth(self): dst_ip = getDstIp(self.ip_packet) msn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177'] isMSNserver = False #determined with an nslookup should be updated if needed for ip in msn_servers: if dst_ip == ip: isMSNserver = True return isMSNserver def test_msn_connection(self): data = self.tcp_packet.get_data_as_string() if getDecFlagsValue(self.tcp_packet) == 2: print "\n",datetime.now().strftime("%b %d, %H:%M:%S")," New Connection on the TCP 1863 (which can be a MSN notification server)!" if re.match("VER 1 ",data): #VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0 #VER 1 MSNP21 if getSrcIp(self.ip_packet) == self.local_ip: print datetime.now().strftime("%b %d, %H:%M:%S")," VER Step detected Client->Server (Protocol version exchange)" else: print datetime.now().strftime("%b %d, %H:%M:%S")," VER Step detected Server->Client (Version %s used)" % (data[6:12]) elif re.match("CVR 2 ",data): #CVR 2 0x0409 winnt 6.1.0 i386 MSNMSGR 15.4.3502.0922 MSNMSGR me@hotmail.fr #VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDENCg== if getSrcIp(self.ip_packet) == self.local_ip: print datetime.now().strftime("%b %d, %H:%M:%S")," CVR Step detected Client->Server (client information sent)" infos = data[6:].split(" ") print "\t\tLocale:%s\tOS:%s(%s)\tArchi:%s\tClient:%s(%s)\tAddress:%s" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]) #Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm else: print datetime.now().strftime("%b %d, %H:%M:%S")," CVR Step detected Server->Client (Stored client information received)" elif re.match("USR 3 ",data): #USR 3 SSO I me@hotmail.fr #alert user send the initiation message of authentication infos = data.split(" ") print datetime.now().strftime("%b %d, %H:%M:%S")," USR Step detected (Initiation authentication) method:%s\tAddress:%s" % (infos[2],infos[4]) elif re.match("USR 4 ",data) and not re.match("USR 4 OK ",data): # USR 4 SSO S t=E (s for subsequent and the ticket attached) #Note SSO was not used to match because I don't know but, may other methods exists print datetime.now().strftime("%b %d, %H:%M:%S")," USR Step detected (Ticket/Token dispatching)" elif re.match("USR 4 OK ",data): #USR 4 OK me@hotmail.fr 1 0 infos= data.split(" ") print datetime.now().strftime("%b %d, %H:%M:%S")," Address %s connected and authenticated to msn !" % (infos[3]) def test_file_transfert(self): data = self.tcp_packet.get_data_as_string() new_data = ["",data] if re.search("INVITE",data):#keep only invitation message notFound = True while notFound: #separate first line from the rest and delete useless \n before new_data = new_data[1].split("\n",1) if re.search("INVITE",new_data[0]): notFound = False else: pass #First element in the array contain invitation message #The second contain mime elements #should do this, because otherwise the mime parsing fail due to the first line which is not mime if len(new_data) >= 2:#otherwise parsing below can fail due to out of range new_data[1] = re.sub(r'\r\n\r\n','\r\n',new_data[1]) mime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload) #So to get payload remove True, and it is accessible with mime_elts.get_payload() if mime_elts['EUF-GUID'] == "{5D3E02AB-6190-11D3-BBBB-00C04F795683}": #This is signature of file transfert ! if re.search("INVITE",new_data[0]):#if it was really an invitation print "\n",datetime.now().strftime("%b %d, %H:%M:%S")," File transfer invitation !" print "\t\tFrom:%s\n\t\tTo:%s" % (mime_elts['From'],mime_elts['To']) #additional tests if mime_elts['CSeq'] == "0 " or mime_elts['CSeq'] == "0":#windows live put a space other client not print "\t\tAnymore CSeq = 0 (file transfer signature)" if mime_elts['appID'] == '2': print "\t\tAnymore AppID = 2 (file transfer signature)" if mime_elts['Content-Type'] == "application/x-msnmsgr-sessionreqbody": print "\t\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\n"
ajibawa-2023/Python-Code-Large/train/row_28
90
147
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_28:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0544, 0.0068, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0068, 0, 0.66, 0.1667, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.068, 0.0068, 0, 0.66, 0.3333, 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_28:ImportFrom_L12_C0", "label": "from packet_function import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0068, 0, 0.66, 0.5, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0884, 0.0068, 0, 0.66, 0.6667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:ImportFrom_L14_C0", "label": "from email.parser import Parser", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0068, 0, 0.66, 0.8333, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "label": "MSN", "type": "class", "loc": [16, 146], "level": 0, "parent": null, "vector": [3, 0, 0.551, 0.8912, 0, 0.66, 1.0, 964, 0, 5, 0, 0, 0, 0, 90], "semantic": {"name": "MSN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MSN:\n\tdef __init__(self,ip, parano=False):\n\t\tself.local_ip = ip\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863\n\t\t\n\tdef analyse(self, data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "label": "__init__", "type": "function", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "vector": [2, 1, 0.1293, 0.034, 1, 0.52, 0.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "ip", "parano"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,ip, parano=False):\n\t\tself.local_ip = ip\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L18_C2", "label": "self.local_ip =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "vector": [14, 2, 0.1224, 0.0068, 2, 0.62, 0.0, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.local_ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.local_ip = ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L19_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "vector": [14, 2, 0.1293, 0.0068, 2, 0.62, 0.3333, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L20_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "vector": [14, 2, 0.1361, 0.0068, 2, 0.62, 0.6667, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L21_C2", "label": "self.paranoid_mode =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "vector": [14, 2, 0.1429, 0.0068, 2, 0.62, 1.0, 218, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.paranoid_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.paranoid_mode = parano #will determine if all tcp packets are examined or just dst.port=1863"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1", "label": "analyse", "type": "function", "loc": [23, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "vector": [2, 1, 0.2823, 0.2585, 1, 0.52, 0.25, 15, 0, 2, 0, 0, 0, 0, 33], "semantic": {"name": "analyse", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\telse:\n\t\t\treturn #jump early to do not slow down traffic\n\t\t\t\n\t\tif isUDP(self.ip_packet):\n\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2", "label": "if", "type": "if", "loc": [24, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1", "vector": [4, 2, 0.1735, 0.0272, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\telse:\n\t\t\treturn #jump early to do not slow down traffic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L25_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2", "vector": [14, 3, 0.1701, 0.0068, 3, 0.54, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L27_C3", "label": "return", "type": "return", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2", "vector": [13, 3, 0.1837, 0.0068, 3, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn #jump early to do not slow down traffic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "label": "if", "type": "if", "loc": [29, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1", "vector": [4, 2, 0.3027, 0.2177, 2, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 0, 31], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isUDP(self.ip_packet):\n\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\n\t\t\tif getDstPortUDP(udp_packet) == 53:\n\t\t\t\tdata = udp_packet.get_data_as_string()\n\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L30_C3", "label": "udp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "vector": [14, 3, 0.2041, 0.0068, 3, 0.06, 0.0, 668, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "udp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\tudp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3", "label": "if", "type": "if", "loc": [32, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "vector": [4, 3, 0.2415, 0.0544, 3, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getDstPortUDP(udp_packet) == 53:\n\t\t\t\tdata = udp_packet.get_data_as_string()\n\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L33_C4", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3", "vector": [14, 4, 0.2245, 0.0068, 4, 0.93, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\t\t\tdata = udp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4", "label": "if", "type": "if", "loc": [34, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3", "vector": [4, 4, 0.2483, 0.0408, 4, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"login.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")\n\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L35_C5", "label": "print()", "type": "expression", "loc": [35, 35], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4", "vector": [8, 5, 0.2381, 0.0068, 5, 0.79, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for login.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4", "label": "if", "type": "if", "loc": [36, 39], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4", "vector": [4, 5, 0.2551, 0.0272, 5, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif re.search(\"messenger.hotmail.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")\n\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L37_C5", "label": "print()", "type": "expression", "loc": [37, 37], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4", "vector": [8, 6, 0.2517, 0.0068, 6, 0.08, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for messenger.hotmail.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L38_C4", "label": "if", "type": "if", "loc": [38, 39], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4", "vector": [4, 6, 0.2619, 0.0136, 6, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif re.search(\"g.live.com\", data):\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L39_C5", "label": "print()", "type": "expression", "loc": [39, 39], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L38_C4", "vector": [8, 7, 0.2653, 0.0068, 7, 0.76, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" DNS request for g.live.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2", "label": "if", "type": "if", "loc": [41, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "vector": [4, 3, 0.3435, 0.1361, 3, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif isTCP(self.ip_packet):\n\t\t\t#All packet from here are normally TCP !\n\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\n\t\t\tif self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80:\n\t\t\t\treturn\n\t\t\t\t#Directly skip all http traffic to avoid useless processing on it because we are not interested in \n\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L43_C3", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2", "vector": [14, 4, 0.2925, 0.0068, 4, 0.58, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3", "label": "if", "type": "if", "loc": [45, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2", "vector": [4, 4, 0.3503, 0.0952, 4, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.tcp_packet.get_th_dport() == 80 or self.tcp_packet.get_th_sport() == 80:\n\t\t\t\treturn\n\t\t\t\t#Directly skip all http traffic to avoid useless processing on it because we are not interested in \n\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\t\t#If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is)\n\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")\n\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L46_C4", "label": "return", "type": "return", "loc": [46, 46], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3", "vector": [13, 5, 0.3129, 0.0068, 5, 0.73, 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_28:If_L48_C3", "label": "if", "type": "if", "loc": [48, 58], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3", "vector": [4, 5, 0.3605, 0.0748, 5, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.tcp_packet.get_th_dport() == 443 and getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\t\t#If we try to connect on a website in https, syn flags to trigger alarm once per connection(if it is)\n\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")\n\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:\n\t\t\t\tself.test_msn_connection()\n\t\t\t\tself.test_file_transfert()\n\t\t\telif self.paranoid_mode:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L50_C4", "label": "if", "type": "if", "loc": [50, 51], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L48_C3", "vector": [4, 6, 0.3435, 0.0136, 6, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.test_https_auth():\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L51_C5", "label": "print()", "type": "expression", "loc": [51, 51], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L50_C4", "vector": [8, 7, 0.3469, 0.0068, 7, 0.23, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Connection on a HTTPS MSN Server (maybe to pick up a authentication ticket)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "label": "if", "type": "if", "loc": [52, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L48_C3", "vector": [4, 6, 0.3741, 0.0476, 6, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.tcp_packet.get_th_dport() == 1863 or self.tcp_packet.get_th_sport() == 1863:\n\t\t\t\tself.test_msn_connection()\n\t\t\t\tself.test_file_transfert()\n\t\t\telif self.paranoid_mode:\n\t\t\t\tself.test_file_transfert()\n\t\t\telse:\n\t\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L53_C4", "label": "test_msn_connection()", "type": "expression", "loc": [53, 53], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "vector": [8, 7, 0.3605, 0.0068, 7, 0.3, 0.0, 573, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_msn_connection", "arg_names": [], "import_names": [], "rhs_call_name": "test_msn_connection", "annotation": ""}, "snippet": "\t\t\t\tself.test_msn_connection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L54_C4", "label": "test_file_transfert()", "type": "expression", "loc": [54, 54], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "vector": [8, 7, 0.3673, 0.0068, 7, 0.3, 0.5, 698, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_file_transfert", "arg_names": [], "import_names": [], "rhs_call_name": "test_file_transfert", "annotation": ""}, "snippet": "\t\t\t\tself.test_file_transfert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L55_C3", "label": "if", "type": "if", "loc": [55, 58], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "vector": [4, 7, 0.3844, 0.0272, 7, 0.3, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\telif self.paranoid_mode:\n\t\t\t\tself.test_file_transfert()\n\t\t\telse:\n\t\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L56_C4", "label": "test_file_transfert()", "type": "expression", "loc": [56, 56], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L55_C3", "vector": [8, 8, 0.381, 0.0068, 8, 0.15, 0.0, 698, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test_file_transfert", "arg_names": [], "import_names": [], "rhs_call_name": "test_file_transfert", "annotation": ""}, "snippet": "\t\t\t\tself.test_file_transfert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "label": "test_https_auth", "type": "function", "loc": [62, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "vector": [2, 1, 0.449, 0.0612, 1, 0.52, 0.5, 107, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "test_https_auth", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_https_auth(self):\n\t\tdst_ip = getDstIp(self.ip_packet)\n\t\tmsn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177']\n\t\tisMSNserver = False\n\t\t#determined with an nslookup should be updated if needed\n\t\tfor ip in msn_servers:\n\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L63_C2", "label": "dst_ip = getDstIp()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "vector": [14, 2, 0.4286, 0.0068, 2, 0.24, 0.0, 161, 3, 1, 0, 0, 768, 10, 1], "semantic": {"name": "dst_ip", "arg_names": [], "import_names": [], "rhs_call_name": "getDstIp", "annotation": ""}, "snippet": "\t\tdst_ip = getDstIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L64_C2", "label": "msn_servers =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "vector": [14, 2, 0.4354, 0.0068, 2, 0.24, 0.25, 543, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "msn_servers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tmsn_servers = ['65.54.165.137','65.54.165.141','65.54.165.139','65.54.165.169','65.54.165.179','65.54.186.77','65.54.165.136','65.54.165.177']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L65_C2", "label": "isMSNserver =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "vector": [14, 2, 0.4422, 0.0068, 2, 0.24, 0.5, 429, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isMSNserver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tisMSNserver = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:For_L67_C2", "label": "for ip", "type": "for", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "vector": [6, 2, 0.4626, 0.0204, 2, 0.24, 0.75, 583, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor ip in msn_servers:\n\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L68_C3", "label": "if", "type": "if", "loc": [68, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:For_L67_C2", "vector": [4, 3, 0.466, 0.0136, 3, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif dst_ip == ip:\n\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L69_C4", "label": "isMSNserver =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L68_C3", "vector": [14, 4, 0.4694, 0.0068, 4, 0.03, 0.0, 429, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isMSNserver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tisMSNserver = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "vector": [13, 2, 0.4762, 0.0068, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn isMSNserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "label": "test_msn_connection", "type": "function", "loc": [72, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "vector": [2, 1, 0.6224, 0.2721, 1, 0.52, 0.75, 573, 0, 1, 0, 0, 0, 0, 38], "semantic": {"name": "test_msn_connection", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_msn_connection(self):\n\t\tdata = self.tcp_packet.get_data_as_string()\n\t\t\n\t\tif getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")\n\t\t\t\n\t\tif re.match(\"VER 1 \",data):\n\t\t\t#VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L73_C2", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "vector": [14, 2, 0.4966, 0.0068, 2, 0.2, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "vector": [4, 2, 0.5136, 0.0136, 2, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif getDecFlagsValue(self.tcp_packet) == 2:\n\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L76_C3", "label": "print()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L75_C2", "vector": [8, 3, 0.517, 0.0068, 3, 0.37, 0.0, 535, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" New Connection on the TCP 1863 (which can be a MSN notification server)!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2", "label": "if", "type": "if", "loc": [78, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "vector": [4, 2, 0.6429, 0.2313, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 0, 33], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif re.match(\"VER 1 \",data):\n\t\t\t#VER 1 MSNP21 MSNP20 MSNP19 MSNP18 MSNP17 CVR0\n\t\t\t#VER 1 MSNP21\n\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))\n\t\t\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3", "label": "if", "type": "if", "loc": [81, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2", "vector": [4, 3, 0.5612, 0.0272, 3, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L82_C4", "label": "print()", "type": "expression", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3", "vector": [8, 4, 0.5578, 0.0068, 4, 0.72, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Client->Server (Protocol version exchange)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3", "vector": [8, 4, 0.5714, 0.0068, 4, 0.72, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" VER Step detected Server->Client (Version %s used)\" % (data[6:12]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2", "label": "if", "type": "if", "loc": [86, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2", "vector": [4, 3, 0.6701, 0.1769, 3, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"CVR 2 \",data):\n\t\t\t#CVR 2 0x0409 winnt 6.1.0 i386 MSNMSGR 15.4.3502.0922 MSNMSGR me@hotmail.fr \n\t\t\t#VmVyc2lvbjogMQ0KWGZyQ291bnQ6IDENCg==\n\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")\n\t\t\t\tinfos = data[6:].split(\" \")\n\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))\n\t\t\t\t#Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "label": "if", "type": "if", "loc": [89, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2", "vector": [4, 4, 0.6259, 0.0476, 4, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif getSrcIp(self.ip_packet) == self.local_ip:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")\n\t\t\t\tinfos = data[6:].split(\" \")\n\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))\n\t\t\t\t#Further about locale :http://krafft.com/scripts/deluxe-calendar/lcid_chart.htm\n\t\t\telse:\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Server->Client (Stored client information received)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "vector": [8, 5, 0.6122, 0.0068, 5, 0.09, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Client->Server (client information sent)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L91_C4", "label": "infos = split()", "type": "assigned_variable", "loc": [91, 91], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "vector": [14, 5, 0.619, 0.0068, 5, 0.09, 0.3333, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\tinfos = data[6:].split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L92_C4", "label": "print()", "type": "expression", "loc": [92, 92], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "vector": [8, 5, 0.6259, 0.0068, 5, 0.09, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(\"\\t\\tLocale:%s\\tOS:%s(%s)\\tArchi:%s\\tClient:%s(%s)\\tAddress:%s\" % (infos[0],infos[1],infos[2],infos[3],infos[4],infos[5],infos[7]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "vector": [8, 5, 0.6463, 0.0068, 5, 0.09, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" CVR Step detected Server->Client (Stored client information received)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "label": "if", "type": "if", "loc": [97, 111], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2", "vector": [4, 4, 0.7075, 0.102, 4, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 3 \",data):\n\t\t\t#USR 3 SSO I me@hotmail.fr\n\t\t\t#alert user send the initiation message of authentication\n\t\t\tinfos = data.split(\" \")\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Initiation authentication) method:%s\\tAddress:%s\" % (infos[2],infos[4]))\n\t\t\t\n\t\telif re.match(\"USR 4 \",data) and not re.match(\"USR 4 OK \",data):\n\t\t\t# USR 4 SSO S t=E (s for subsequent and the ticket attached)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L100_C3", "label": "infos = split()", "type": "assigned_variable", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "vector": [14, 5, 0.6803, 0.0068, 5, 0.92, 0.0, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\tinfos = data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L101_C3", "label": "print()", "type": "expression", "loc": [101, 101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "vector": [8, 5, 0.6871, 0.0068, 5, 0.92, 0.5, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Initiation authentication) method:%s\\tAddress:%s\" % (infos[2],infos[4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2", "label": "if", "type": "if", "loc": [103, 111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "vector": [4, 5, 0.7279, 0.0612, 5, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 4 \",data) and not re.match(\"USR 4 OK \",data):\n\t\t\t# USR 4 SSO S t=E (s for subsequent and the ticket attached)\n\t\t\t#Note SSO was not used to match because I don't know but, may other methods exists\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Ticket/Token dispatching)\")\n\t\t\t\n\t\telif re.match(\"USR 4 OK \",data):\n\t\t\t#USR 4 OK me@hotmail.fr 1 0\n\t\t\tinfos= data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L106_C3", "label": "print()", "type": "expression", "loc": [106, 106], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2", "vector": [8, 6, 0.7211, 0.0068, 6, 0.56, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" USR Step detected (Ticket/Token dispatching)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2", "label": "if", "type": "if", "loc": [108, 111], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2", "vector": [4, 6, 0.7449, 0.0272, 6, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif re.match(\"USR 4 OK \",data):\n\t\t\t#USR 4 OK me@hotmail.fr 1 0\n\t\t\tinfos= data.split(\" \")\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Address %s connected and authenticated to msn !\" % (infos[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L110_C3", "label": "infos = split()", "type": "assigned_variable", "loc": [110, 110], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2", "vector": [14, 7, 0.7483, 0.0068, 7, 0.51, 0.0, 305, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "infos", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\tinfos= data.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L111_C3", "label": "print()", "type": "expression", "loc": [111, 111], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2", "vector": [8, 7, 0.7551, 0.0068, 7, 0.51, 1.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" Address %s connected and authenticated to msn !\" % (infos[3]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "label": "test_file_transfert", "type": "function", "loc": [113, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "vector": [2, 1, 0.881, 0.2313, 1, 0.52, 1.0, 698, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "test_file_transfert", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef test_file_transfert(self):\n\t\tdata = self.tcp_packet.get_data_as_string()\n\t\tnew_data = [\"\",data]\n\t\tif re.search(\"INVITE\",data):#keep only invitation message\n\t\t\tnotFound = True\n\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L114_C2", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "vector": [14, 2, 0.7755, 0.0068, 2, 0.13, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L115_C2", "label": "new_data =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "vector": [14, 2, 0.7823, 0.0068, 2, 0.13, 0.3333, 524, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tnew_data = [\"\",data]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2", "label": "if", "type": "if", "loc": [116, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "vector": [4, 2, 0.8129, 0.0544, 2, 0.13, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif re.search(\"INVITE\",data):#keep only invitation message\n\t\t\tnotFound = True\n\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False\n\t\telse:\n\t\t\tpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L117_C3", "label": "notFound =", "type": "assigned_variable", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2", "vector": [14, 3, 0.7959, 0.0068, 3, 0.26, 0.0, 513, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "notFound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tnotFound = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3", "label": "while", "type": "while", "loc": [118, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2", "vector": [5, 3, 0.8129, 0.0272, 3, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\twhile notFound: #separate first line from the rest and delete useless \\n before\n\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L119_C4", "label": "new_data = split()", "type": "assigned_variable", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3", "vector": [14, 4, 0.8095, 0.0068, 4, 0.38, 0.0, 524, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "new_data", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\tnew_data = new_data[1].split(\"\\n\",1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L120_C4", "label": "if", "type": "if", "loc": [120, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3", "vector": [4, 4, 0.8197, 0.0136, 4, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"INVITE\",new_data[0]):\n\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L121_C5", "label": "notFound =", "type": "assigned_variable", "loc": [121, 121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L120_C4", "vector": [14, 5, 0.8231, 0.0068, 5, 0.78, 0.0, 513, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "notFound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tnotFound = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "label": "if", "type": "if", "loc": [128, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "vector": [4, 2, 0.932, 0.1293, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(new_data) >= 2:#otherwise parsing below can fail due to out of range\n\t\t\t\n\t\t\tnew_data[1] = re.sub(r'\\r\\n\\r\\n','\\r\\n',new_data[1])\n\t\t\tmime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload)\n\t\t\t#So to get payload remove True, and it is accessible with mime_elts.get_payload()\n\t\t\t\n\t\t\t\n\t\t\tif mime_elts['EUF-GUID'] == \"{5D3E02AB-6190-11D3-BBBB-00C04F795683}\": #This is signature of file transfert !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L130_C3", "label": " = sub()", "type": "assigned_variable", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "vector": [14, 3, 0.8844, 0.0068, 3, 0.0, 0.0, 0, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": "\t\t\tnew_data[1] = re.sub(r'\\r\\n\\r\\n','\\r\\n',new_data[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L131_C3", "label": "mime_elts = parsestr()", "type": "assigned_variable", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "vector": [14, 3, 0.8912, 0.0068, 3, 0.0, 0.5, 282, 3, 2, 0, 0, 781, 10, 2], "semantic": {"name": "mime_elts", "arg_names": [], "import_names": [], "rhs_call_name": "parsestr", "annotation": ""}, "snippet": "\t\t\tmime_elts = Parser().parsestr(new_data[1],True) # parse the packet as mime type (True means ignore payload)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L135_C3", "label": "if", "type": "if", "loc": [135, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "vector": [4, 3, 0.9558, 0.0816, 3, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif mime_elts['EUF-GUID'] == \"{5D3E02AB-6190-11D3-BBBB-00C04F795683}\": #This is signature of file transfert !\n\t\t\t\tif re.search(\"INVITE\",new_data[0]):#if it was really an invitation\n\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")\n\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))\n\t\t\t\t\t\n\t\t\t\t\t#additional tests\n\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "label": "if", "type": "if", "loc": [136, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L135_C3", "vector": [4, 4, 0.9592, 0.0748, 4, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif re.search(\"INVITE\",new_data[0]):#if it was really an invitation\n\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")\n\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))\n\t\t\t\t\t\n\t\t\t\t\t#additional tests\n\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")\n\t\t\t\t\tif mime_elts['appID'] == '2':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L137_C5", "label": "print()", "type": "expression", "loc": [137, 137], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "vector": [8, 5, 0.932, 0.0068, 5, 0.7, 0.0, 535, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(\"\\n\",datetime.now().strftime(\"%b %d, %H:%M:%S\"),\" File transfer invitation !\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L138_C5", "label": "print()", "type": "expression", "loc": [138, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "vector": [8, 5, 0.9388, 0.0068, 5, 0.7, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(\"\\t\\tFrom:%s\\n\\t\\tTo:%s\" % (mime_elts['From'],mime_elts['To']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L141_C5", "label": "if", "type": "if", "loc": [141, 142], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "vector": [4, 5, 0.9626, 0.0136, 5, 0.7, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['CSeq'] == \"0 \" or mime_elts['CSeq'] == \"0\":#windows live put a space other client not\n\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L142_C6", "label": "print()", "type": "expression", "loc": [142, 142], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L141_C5", "vector": [8, 6, 0.966, 0.0068, 6, 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": "\t\t\t\t\t\tprint(\"\\t\\tAnymore CSeq = 0 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L143_C5", "label": "if", "type": "if", "loc": [143, 144], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "vector": [4, 5, 0.9762, 0.0136, 5, 0.7, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['appID'] == '2':\n\t\t\t\t\t\tprint(\"\\t\\tAnymore AppID = 2 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L144_C6", "label": "print()", "type": "expression", "loc": [144, 144], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L143_C5", "vector": [8, 6, 0.9796, 0.0068, 6, 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": "\t\t\t\t\t\tprint(\"\\t\\tAnymore AppID = 2 (file transfer signature)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:If_L145_C5", "label": "if", "type": "if", "loc": [145, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "vector": [4, 5, 0.9898, 0.0136, 5, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif mime_elts['Content-Type'] == \"application/x-msnmsgr-sessionreqbody\":\n\t\t\t\t\t\tprint(\"\\t\\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L146_C6", "label": "print()", "type": "expression", "loc": [146, 146], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_28:If_L145_C5", "vector": [8, 6, 0.9932, 0.0068, 6, 0.62, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\t\tprint(\"\\t\\tAnymore Content-Type = application/x-msnmsgr-sessionreqbody (file transfer signature)\\n\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L17_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L25_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L27_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L30_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L35_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L37_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L39_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L29_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L43_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L45_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L48_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L48_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L51_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L48_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L52_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L55_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:For_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:For_L67_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L68_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L62_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L76_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L72_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L81_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L89_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L100_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L110_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L108_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L111_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L117_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L116_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:While_L118_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L121_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:FunctionDef_L113_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L130_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Assign_L131_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L135_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L135_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L137_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L138_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L141_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L141_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L142_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L143_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L143_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L144_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_28:If_L145_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_28:If_L145_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_28:Expr_L146_C6"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime import time import re #regular expression from email.parser import Parser #parser for mime type ! from packet_function import * class BBC: def __init__(self): self.ip_packet = list() self.tcp_packet = list() self.lastmessage = "" def analyse(self, data): if isIP(data): self.ip_packet = getIPPacket(data) if isTCP(self.ip_packet): self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 1935: data = self.tcp_packet.get_data_as_string() if re.search("www..?bbc.c.?o.uk",data): #if pattern found then try to pick up path of stream url_path = re.findall("(?!www\.bbc\/c.?o\.uk).*www\..?bbc\.co\.uk(.*)...$",data)[0] ip = getSrcIp(self.ip_packet) mess = "IP:%s\t Stream:www.bbc.co.uk%s" % (ip,url_path) if mess != self.lastmessage: #avoid redundancy of message for same request and same ip print datetime.now().strftime("%b %d, %H:%M:%S"),mess self.lastmessage = mess
ajibawa-2023/Python-Code-Large/train/row_29
26
40
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_29:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.025, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.225, 0.025, 0, 0.66, 0.1429, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.025, 0, 0.66, 0.2857, 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_29:Import_L11_C0", "label": "time import time", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.275, 0.025, 0, 0.66, 0.4286, 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_29:Import_L12_C0", "label": "re import re", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.025, 0, 0.66, 0.5714, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:ImportFrom_L13_C0", "label": "from email.parser import Parser", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.325, 0.025, 0, 0.66, 0.7143, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:ImportFrom_L15_C0", "label": "from packet_function import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.375, 0.025, 0, 0.66, 0.8571, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:ClassDef_L18_C0", "label": "BBC", "type": "class", "loc": [18, 40], "level": 0, "parent": null, "vector": [3, 0, 0.725, 0.575, 0, 0.66, 1.0, 547, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "BBC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BBC:\n\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.lastmessage = \"\"\n\t\t\n\tdef analyse(self, data):\n\t\tif isIP(data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "label": "__init__", "type": "function", "loc": [19, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:ClassDef_L18_C0", "vector": [2, 1, 0.5125, 0.1, 1, 0.72, 0.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.lastmessage = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L20_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "vector": [14, 2, 0.5, 0.025, 2, 0.06, 0.0, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L21_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "vector": [14, 2, 0.525, 0.025, 2, 0.06, 0.5, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L22_C2", "label": "self.lastmessage =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "vector": [14, 2, 0.55, 0.025, 2, 0.06, 1.0, 654, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.lastmessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastmessage = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L24_C1", "label": "analyse", "type": "function", "loc": [24, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:ClassDef_L18_C0", "vector": [2, 1, 0.8, 0.425, 1, 0.72, 1.0, 15, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "analyse", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2", "label": "if", "type": "if", "loc": [25, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L24_C1", "vector": [4, 2, 0.8125, 0.4, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L26_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2", "vector": [14, 3, 0.65, 0.025, 3, 0.52, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3", "label": "if", "type": "if", "loc": [28, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2", "vector": [4, 3, 0.85, 0.325, 3, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()\n\n\t\t\t\t\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L29_C4", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [29, 29], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3", "vector": [14, 4, 0.725, 0.025, 4, 0.09, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4", "label": "if", "type": "if", "loc": [31, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3", "vector": [4, 4, 0.8875, 0.25, 4, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()\n\n\t\t\t\t\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]\n\t\t\t\t\t\tip = getSrcIp(self.ip_packet)\n\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)\n\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L32_C5", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [32, 32], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4", "vector": [14, 5, 0.8, 0.025, 5, 0.74, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "label": "if", "type": "if", "loc": [34, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4", "vector": [4, 5, 0.925, 0.175, 5, 0.74, 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\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]\n\t\t\t\t\t\tip = getSrcIp(self.ip_packet)\n\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)\n\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip\n\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)\n\t\t\t\t\t\t\tself.lastmessage = mess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L35_C6", "label": "url_path =", "type": "assigned_variable", "loc": [35, 35], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "vector": [14, 6, 0.875, 0.025, 6, 0.1, 0.0, 872, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "url_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L36_C6", "label": "ip = getSrcIp()", "type": "assigned_variable", "loc": [36, 36], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "vector": [14, 6, 0.9, 0.025, 6, 0.1, 0.3333, 583, 3, 1, 0, 0, 792, 10, 1], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "getSrcIp", "annotation": ""}, "snippet": "\t\t\t\t\t\tip = getSrcIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L37_C6", "label": "mess =", "type": "assigned_variable", "loc": [37, 37], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "vector": [14, 6, 0.925, 0.025, 6, 0.1, 0.6667, 364, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6", "label": "if", "type": "if", "loc": [38, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "vector": [4, 6, 0.975, 0.075, 6, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip\n\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)\n\t\t\t\t\t\t\tself.lastmessage = mess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Expr_L39_C7", "label": "print()", "type": "expression", "loc": [39, 39], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6", "vector": [8, 7, 0.975, 0.025, 7, 0.32, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L40_C7", "label": "self.lastmessage =", "type": "assigned_variable", "loc": [40, 40], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6", "vector": [14, 7, 1.0, 0.025, 7, 0.32, 1.0, 654, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lastmessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\t\tself.lastmessage = mess"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_29:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:FunctionDef_L24_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L26_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L28_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L32_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L35_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L36_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L37_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Expr_L39_C7"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_29:If_L38_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_29:Assign_L40_C7"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime import time from packet_function import * import re #regular expression from email.parser import Parser #parser for mime type ! class Triplet: def __init__(self, port_nb): self.port = port_nb self.packet_list = list() #list of the date of the reception of the 3 packets ! def getPortName(self): return self.port def getIndex(self): return len(self.packet_list)-1 def addElement(self,time): if len(self.packet_list) < 3: self.packet_list.append(time) def getElement(self,i): return self.packet_list[i] class SuspectIP: def __init__(self,ip,time): self.ip = ip self.nbpacket = 0 self.triplet_list = list() #List of triplet (normally maximum 10 triplets (3*10)) self.firstpacket_received = time self.lastpacket_received = 0 def getIP(self): return self.ip def getLastPacketDate(self): return self.lastpacket_received def addPacket(self,port,time_recep): self.lastpacket_received = time_recep exist = False for i in range(len(self.triplet_list)): #check all element of the list of suspect if self.triplet_list[i].getPortName() == port: #if already in the list exist = True cur = self.triplet_list[i] cur.addElement(time_recep) #add element to the triplet index = cur.getIndex() self.nbpacket += 1 print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s" % (self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime("%H:%M:%S"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket) if self.nbpacket == 30: print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s all packet from botnet signature detected in %s seconds" % (self.ip, self.lastpacket_received - self.firstpacket_received) if not exist: new = Triplet(port) #Creation of the new suspect and push it in the list new.addElement(time_recep) self.nbpacket += 1 self.triplet_list.append(new) print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime("%H:%M:%S"),self.nbpacket) #--------------------# # Class Botnet # #--------------------# class botnet: def __init__(self): self.ip_packet = list() self.tcp_packet = list() self.suspect_list = list() def analyse(self, data,time_recep): if isIP(data): self.ip_packet = getIPPacket(data) srcip = getSrcIp(self.ip_packet) if isTCP(self.ip_packet): self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == "192.168.5.13" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements self.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep) self.update_list() def processPacket(self, ip,port,rec_time): exist = False for suspect in self.suspect_list: if suspect.getIP() == ip: exist = True suspect.addPacket(port,rec_time) if not exist: new = SuspectIP(ip,rec_time) new.addPacket(port,rec_time) self.suspect_list.append(new) def update_list(self): for i in range(len(self.suspect_list)): if (time.time() - self.suspect_list[i].getLastPacketDate()) > 240: #if the last packet of the host is older than 4 minutes print self.suspect_list[i].getIP()," reseted (botnet)" del self.suspect_list[i]
ajibawa-2023/Python-Code-Large/train/row_33
76
110
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_33:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0727, 0.0091, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0818, 0.0091, 0, 0.66, 0.1111, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0091, 0, 0.66, 0.2222, 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_33:Import_L11_C0", "label": "time import time", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0091, 0, 0.66, 0.3333, 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_33:ImportFrom_L12_C0", "label": "from packet_function import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1091, 0.0091, 0, 0.66, 0.4444, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1182, 0.0091, 0, 0.66, 0.5556, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ImportFrom_L14_C0", "label": "from email.parser import Parser", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1273, 0.0091, 0, 0.66, 0.6667, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "label": "Triplet", "type": "class", "loc": [18, 34], "level": 0, "parent": null, "vector": [3, 0, 0.2364, 0.1545, 0, 0.66, 0.7778, 707, 0, 5, 0, 0, 0, 0, 4], "semantic": {"name": "Triplet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Triplet:\n\tdef __init__(self, port_nb):\n\t\tself.port = port_nb\n\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !\n\t\n\tdef getPortName(self):\n\t\treturn self.port\n\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1", "label": "__init__", "type": "function", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "vector": [2, 1, 0.1818, 0.0273, 1, 0.33, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "port_nb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, port_nb):\n\t\tself.port = port_nb\n\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L20_C2", "label": "self.port =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1", "vector": [14, 2, 0.1818, 0.0091, 2, 0.47, 0.0, 435, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.port = port_nb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L21_C2", "label": "self.packet_list = list()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1", "vector": [14, 2, 0.1909, 0.0091, 2, 0.47, 1.0, 702, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.packet_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L23_C1", "label": "getPortName", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "vector": [2, 1, 0.2136, 0.0182, 1, 0.33, 0.25, 34, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getPortName", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getPortName(self):\n\t\treturn self.port"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L23_C1", "vector": [13, 2, 0.2182, 0.0091, 2, 0.74, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.port"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L26_C1", "label": "getIndex", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "vector": [2, 1, 0.2409, 0.0182, 1, 0.33, 0.5, 634, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getIndex", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getIndex(self):\n\t\treturn len(self.packet_list)-1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L26_C1", "vector": [13, 2, 0.2455, 0.0091, 2, 0.95, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn len(self.packet_list)-1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L29_C1", "label": "addElement", "type": "function", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "vector": [2, 1, 0.2727, 0.0273, 1, 0.33, 0.75, 475, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addElement", "arg_names": ["self", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef addElement(self,time):\n\t\tif len(self.packet_list) < 3:\n\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L29_C1", "vector": [4, 2, 0.2773, 0.0182, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(self.packet_list) < 3:\n\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L31_C3", "label": "append()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L30_C2", "vector": [8, 3, 0.2818, 0.0091, 3, 0.22, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L33_C1", "label": "getElement", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "vector": [2, 1, 0.3045, 0.0182, 1, 0.33, 1.0, 274, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "getElement", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getElement(self,i):\n\t\treturn self.packet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L34_C2", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L33_C1", "vector": [13, 2, 0.3091, 0.0091, 2, 0.24, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.packet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "label": "SuspectIP", "type": "class", "loc": [37, 69], "level": 0, "parent": null, "vector": [3, 0, 0.4818, 0.3, 0, 0.66, 0.8889, 126, 0, 4, 0, 0, 0, 0, 26], "semantic": {"name": "SuspectIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SuspectIP:\n\tdef __init__(self,ip,time):\n\t\tself.ip = ip\n\t\tself.nbpacket = 0\n\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))\n\t\tself.firstpacket_received = time\n\t\tself.lastpacket_received = 0\n\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "label": "__init__", "type": "function", "loc": [38, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "vector": [2, 1, 0.3682, 0.0545, 1, 0.17, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "ip", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,ip,time):\n\t\tself.ip = ip\n\t\tself.nbpacket = 0\n\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))\n\t\tself.firstpacket_received = time\n\t\tself.lastpacket_received = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L39_C2", "label": "self.ip =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "vector": [14, 2, 0.3545, 0.0091, 2, 0.61, 0.0, 225, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.ip = ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L40_C2", "label": "self.nbpacket =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "vector": [14, 2, 0.3636, 0.0091, 2, 0.61, 0.25, 569, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.nbpacket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.nbpacket = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L41_C2", "label": "self.triplet_list = list()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "vector": [14, 2, 0.3727, 0.0091, 2, 0.61, 0.5, 449, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.triplet_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L42_C2", "label": "self.firstpacket_received =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "vector": [14, 2, 0.3818, 0.0091, 2, 0.61, 0.75, 499, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.firstpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.firstpacket_received = time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L43_C2", "label": "self.lastpacket_received =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "vector": [14, 2, 0.3909, 0.0091, 2, 0.61, 1.0, 145, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.lastpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastpacket_received = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L45_C1", "label": "getIP", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "vector": [2, 1, 0.4136, 0.0182, 1, 0.17, 0.3333, 134, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getIP", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getIP(self):\n\t\treturn self.ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L45_C1", "vector": [13, 2, 0.4182, 0.0091, 2, 0.44, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L48_C1", "label": "getLastPacketDate", "type": "function", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "vector": [2, 1, 0.4409, 0.0182, 1, 0.17, 0.6667, 964, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getLastPacketDate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getLastPacketDate(self):\n\t\treturn self.lastpacket_received"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L49_C2", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L48_C1", "vector": [13, 2, 0.4455, 0.0091, 2, 0.53, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.lastpacket_received"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "label": "addPacket", "type": "function", "loc": [51, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "vector": [2, 1, 0.5455, 0.1727, 1, 0.17, 1.0, 940, 0, 3, 0, 0, 0, 0, 25], "semantic": {"name": "addPacket", "arg_names": ["self", "port", "time_recep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef addPacket(self,port,time_recep):\n\t\tself.lastpacket_received = time_recep\n\t\texist = False\n\t\tfor i in range(len(self.triplet_list)):\t\t\t\t#check all element of the list of suspect\n\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L52_C2", "label": "self.lastpacket_received =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "vector": [14, 2, 0.4727, 0.0091, 2, 0.56, 0.0, 145, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lastpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastpacket_received = time_recep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L53_C2", "label": "exist =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "vector": [14, 2, 0.4818, 0.0091, 2, 0.56, 0.3333, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\texist = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:For_L54_C2", "label": "for i", "type": "for", "loc": [54, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "vector": [6, 2, 0.5318, 0.0909, 2, 0.56, 0.6667, 826, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in range(len(self.triplet_list)):\t\t\t\t#check all element of the list of suspect\n\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet\n\t\t\t\tindex = cur.getIndex()\n\t\t\t\tself.nbpacket += 1\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "label": "if", "type": "if", "loc": [55, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:For_L54_C2", "vector": [4, 3, 0.5364, 0.0818, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet\n\t\t\t\tindex = cur.getIndex()\n\t\t\t\tself.nbpacket += 1\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))\n\t\t\t\tif self.nbpacket == 30:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L56_C4", "label": "exist =", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [14, 4, 0.5091, 0.0091, 4, 0.05, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\texist = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L57_C4", "label": "cur =", "type": "assigned_variable", "loc": [57, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [14, 4, 0.5182, 0.0091, 4, 0.05, 0.2, 834, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tcur = self.triplet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L58_C4", "label": "addElement()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [8, 4, 0.5273, 0.0091, 4, 0.05, 0.4, 475, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addElement", "arg_names": [], "import_names": [], "rhs_call_name": "addElement", "annotation": ""}, "snippet": "\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L59_C4", "label": "index = getIndex()", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [14, 4, 0.5364, 0.0091, 4, 0.05, 0.6, 780, 3, 0, 0, 0, 634, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "getIndex", "annotation": ""}, "snippet": "\t\t\t\tindex = cur.getIndex()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L61_C4", "label": "print()", "type": "expression", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [8, 4, 0.5545, 0.0091, 4, 0.05, 0.8, 535, 3, 2, 0, 0, 0, 0, 9], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "vector": [4, 4, 0.5682, 0.0182, 4, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.nbpacket == 30:\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s all packet from botnet signature detected in %s seconds\" % (self.ip, self.lastpacket_received - self.firstpacket_received))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L63_C5", "label": "print()", "type": "expression", "loc": [63, 63], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L62_C4", "vector": [8, 5, 0.5727, 0.0091, 5, 0.44, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s all packet from botnet signature detected in %s seconds\" % (self.ip, self.lastpacket_received - self.firstpacket_received))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "label": "if", "type": "if", "loc": [64, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "vector": [4, 2, 0.6045, 0.0545, 2, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not exist:\n\t\t\tnew = Triplet(port)\t\t#Creation of the new suspect and push it in the list\n\t\t\tnew.addElement(time_recep)\n\t\t\tself.nbpacket += 1\n\t\t\tself.triplet_list.append(new)\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s\" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime(\"%H:%M:%S\"),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L65_C3", "label": "new = Triplet()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "vector": [14, 3, 0.5909, 0.0091, 3, 0.12, 0.0, 145, 3, 1, 0, 0, 707, 10, 1], "semantic": {"name": "new", "arg_names": [], "import_names": [], "rhs_call_name": "Triplet", "annotation": ""}, "snippet": "\t\t\tnew = Triplet(port)\t\t#Creation of the new suspect and push it in the list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L66_C3", "label": "addElement()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "vector": [8, 3, 0.6, 0.0091, 3, 0.12, 0.3333, 475, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addElement", "arg_names": [], "import_names": [], "rhs_call_name": "addElement", "annotation": ""}, "snippet": "\t\t\tnew.addElement(time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L68_C3", "label": "append()", "type": "expression", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "vector": [8, 3, 0.6182, 0.0091, 3, 0.12, 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\tself.triplet_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L69_C3", "label": "print()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "vector": [8, 3, 0.6273, 0.0091, 3, 0.12, 1.0, 535, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s\" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime(\"%H:%M:%S\"),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "label": "botnet", "type": "class", "loc": [75, 110], "level": 0, "parent": null, "vector": [3, 0, 0.8409, 0.3273, 0, 0.66, 1.0, 761, 0, 4, 0, 0, 0, 0, 25], "semantic": {"name": "botnet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class botnet:\n\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.suspect_list = list()\n\t\t\n\tdef analyse(self, data,time_recep):\n\t\tif isIP(data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "label": "__init__", "type": "function", "loc": [76, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "vector": [2, 1, 0.7045, 0.0364, 1, 0.2, 0.0, 555, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.suspect_list = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L77_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "vector": [14, 2, 0.7, 0.0091, 2, 0.2, 0.0, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L78_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "vector": [14, 2, 0.7091, 0.0091, 2, 0.2, 0.5, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L79_C2", "label": "self.suspect_list = list()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "vector": [14, 2, 0.7182, 0.0091, 2, 0.2, 1.0, 273, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.suspect_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.suspect_list = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1", "label": "analyse", "type": "function", "loc": [81, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "vector": [2, 1, 0.7818, 0.1, 1, 0.2, 0.3333, 15, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "analyse", "arg_names": ["self", "data", "time_recep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data,time_recep):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\tsrcip = getSrcIp(self.ip_packet)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "label": "if", "type": "if", "loc": [82, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1", "vector": [4, 2, 0.7818, 0.0818, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\tsrcip = getSrcIp(self.ip_packet)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L83_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "vector": [14, 3, 0.7545, 0.0091, 3, 0.98, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L84_C3", "label": "srcip = getSrcIp()", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "vector": [14, 3, 0.7636, 0.0091, 3, 0.98, 0.5, 210, 3, 1, 0, 0, 792, 10, 1], "semantic": {"name": "srcip", "arg_names": [], "import_names": [], "rhs_call_name": "getSrcIp", "annotation": ""}, "snippet": "\t\t\tsrcip = getSrcIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3", "label": "if", "type": "if", "loc": [86, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "vector": [4, 3, 0.8, 0.0455, 3, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements\n\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L87_C4", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3", "vector": [14, 4, 0.7909, 0.0091, 4, 0.64, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L89_C4", "label": "if", "type": "if", "loc": [89, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3", "vector": [4, 4, 0.8136, 0.0182, 4, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements\n\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L90_C5", "label": "processPacket()", "type": "expression", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L89_C4", "vector": [8, 5, 0.8182, 0.0091, 5, 0.01, 0.0, 826, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "processPacket", "arg_names": [], "import_names": [], "rhs_call_name": "processPacket", "annotation": ""}, "snippet": "\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L91_C2", "label": "update_list()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1", "vector": [8, 2, 0.8273, 0.0091, 2, 0.87, 1.0, 886, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_list", "arg_names": [], "import_names": [], "rhs_call_name": "update_list", "annotation": ""}, "snippet": "\t\tself.update_list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "label": "processPacket", "type": "function", "loc": [94, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "vector": [2, 1, 0.8955, 0.0909, 1, 0.2, 0.6667, 826, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "processPacket", "arg_names": ["self", "ip", "port", "rec_time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef processPacket(self, ip,port,rec_time):\n\t\texist = False\n\t\tfor suspect in self.suspect_list:\n\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)\n\t\tif not exist:\n\t\t\tnew = SuspectIP(ip,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L95_C2", "label": "exist =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "vector": [14, 2, 0.8636, 0.0091, 2, 0.41, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\texist = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:For_L96_C2", "label": "for suspect", "type": "for", "loc": [96, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "vector": [6, 2, 0.8864, 0.0364, 2, 0.41, 0.5, 780, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "suspect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor suspect in self.suspect_list:\n\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3", "label": "if", "type": "if", "loc": [97, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:For_L96_C2", "vector": [4, 3, 0.8909, 0.0273, 3, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L98_C4", "label": "exist =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3", "vector": [14, 4, 0.8909, 0.0091, 4, 0.21, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\texist = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L99_C4", "label": "addPacket()", "type": "expression", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3", "vector": [8, 4, 0.9, 0.0091, 4, 0.21, 1.0, 940, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addPacket", "arg_names": [], "import_names": [], "rhs_call_name": "addPacket", "annotation": ""}, "snippet": "\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "label": "if", "type": "if", "loc": [100, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "vector": [4, 2, 0.9227, 0.0364, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not exist:\n\t\t\tnew = SuspectIP(ip,rec_time)\n\t\t\tnew.addPacket(port,rec_time)\n\t\t\tself.suspect_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L101_C3", "label": "new = SuspectIP()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "vector": [14, 3, 0.9182, 0.0091, 3, 0.3, 0.0, 145, 3, 2, 0, 0, 126, 10, 1], "semantic": {"name": "new", "arg_names": [], "import_names": [], "rhs_call_name": "SuspectIP", "annotation": ""}, "snippet": "\t\t\tnew = SuspectIP(ip,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L102_C3", "label": "addPacket()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "vector": [8, 3, 0.9273, 0.0091, 3, 0.3, 0.5, 940, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addPacket", "arg_names": [], "import_names": [], "rhs_call_name": "addPacket", "annotation": ""}, "snippet": "\t\t\tnew.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L103_C3", "label": "append()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "vector": [8, 3, 0.9364, 0.0091, 3, 0.3, 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\tself.suspect_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L105_C1", "label": "update_list", "type": "function", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "vector": [2, 1, 0.9773, 0.0545, 1, 0.2, 1.0, 886, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "update_list", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef update_list(self):\n\t\tfor i in range(len(self.suspect_list)):\n\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:For_L106_C2", "label": "for i", "type": "for", "loc": [106, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L105_C1", "vector": [6, 2, 0.9818, 0.0455, 2, 0.31, 0.0, 826, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in range(len(self.suspect_list)):\n\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:If_L107_C3", "label": "if", "type": "if", "loc": [107, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:For_L106_C2", "vector": [4, 3, 0.9864, 0.0364, 3, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L109_C4", "label": "print()", "type": "expression", "loc": [109, 109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_33:If_L107_C3", "vector": [8, 4, 0.9909, 0.0091, 4, 0.53, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L33_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L48_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L48_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Return_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:For_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:For_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L63_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L66_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L69_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L83_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L86_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L90_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L81_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:For_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:For_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Assign_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L102_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L103_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L105_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:FunctionDef_L105_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_33:For_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_33:If_L107_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_33:If_L107_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_33:Expr_L109_C4"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime import time from packet_function import * import re #regular expression from email.parser import Parser #parser for mime type ! class Triplet: def __init__(self, port_nb): self.port = port_nb self.packet_list = list() #list of the date of the reception of the 3 packets ! def getPortName(self): return self.port def getIndex(self): return len(self.packet_list)-1 def addElement(self,time): if len(self.packet_list) < 3: self.packet_list.append(time) def getElement(self,i): return self.packet_list[i] class SuspectIP: def __init__(self,ip,time): self.ip = ip self.nbpacket = 0 self.triplet_list = list() #List of triplet (normally maximum 10 triplets (3*10)) self.firstpacket_received = time self.lastpacket_received = 0 def getIP(self): return self.ip def getLastPacketDate(self): return self.lastpacket_received def addPacket(self,port,time_recep): self.lastpacket_received = time_recep exist = False for i in range(len(self.triplet_list)): #check all element of the list of suspect if self.triplet_list[i].getPortName() == port: #if already in the list exist = True cur = self.triplet_list[i] cur.addElement(time_recep) #add element to the triplet index = cur.getIndex() self.nbpacket += 1 print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s" % (self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime("%H:%M:%S"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket) if self.nbpacket == 30: print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s all packet from botnet signature detected in %s seconds" % (self.ip, self.lastpacket_received - self.firstpacket_received) if not exist: new = Triplet(port) #Creation of the new suspect and push it in the list new.addElement(time_recep) self.nbpacket += 1 self.triplet_list.append(new) print datetime.now().strftime("%b %d, %H:%M:%S"),"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime("%H:%M:%S"),self.nbpacket) #--------------------# # Class Botnet # #--------------------# class botnet: def __init__(self): self.ip_packet = list() self.tcp_packet = list() self.suspect_list = list() def analyse(self, data,time_recep): if isIP(data): self.ip_packet = getIPPacket(data) srcip = getSrcIp(self.ip_packet) if isTCP(self.ip_packet): self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == "192.168.5.13" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements self.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep) self.update_list() def processPacket(self, ip,port,rec_time): exist = False for suspect in self.suspect_list: if suspect.getIP() == ip: exist = True suspect.addPacket(port,rec_time) if not exist: new = SuspectIP(ip,rec_time) new.addPacket(port,rec_time) self.suspect_list.append(new) def update_list(self): for i in range(len(self.suspect_list)): if (time.time() - self.suspect_list[i].getLastPacketDate()) > 240: #if the last packet of the host is older than 4 minutes print self.suspect_list[i].getIP()," reseted (botnet)" del self.suspect_list[i]
ajibawa-2023/Python-Code-Large/train/row_34
76
110
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_34:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0727, 0.0091, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0818, 0.0091, 0, 0.66, 0.1111, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0091, 0, 0.66, 0.2222, 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_34:Import_L11_C0", "label": "time import time", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.0091, 0, 0.66, 0.3333, 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_34:ImportFrom_L12_C0", "label": "from packet_function import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1091, 0.0091, 0, 0.66, 0.4444, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1182, 0.0091, 0, 0.66, 0.5556, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ImportFrom_L14_C0", "label": "from email.parser import Parser", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1273, 0.0091, 0, 0.66, 0.6667, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "label": "Triplet", "type": "class", "loc": [18, 34], "level": 0, "parent": null, "vector": [3, 0, 0.2364, 0.1545, 0, 0.66, 0.7778, 707, 0, 5, 0, 0, 0, 0, 4], "semantic": {"name": "Triplet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Triplet:\n\tdef __init__(self, port_nb):\n\t\tself.port = port_nb\n\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !\n\t\n\tdef getPortName(self):\n\t\treturn self.port\n\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1", "label": "__init__", "type": "function", "loc": [19, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "vector": [2, 1, 0.1818, 0.0273, 1, 0.61, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "port_nb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, port_nb):\n\t\tself.port = port_nb\n\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L20_C2", "label": "self.port =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1", "vector": [14, 2, 0.1818, 0.0091, 2, 0.49, 0.0, 435, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.port = port_nb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L21_C2", "label": "self.packet_list = list()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1", "vector": [14, 2, 0.1909, 0.0091, 2, 0.49, 1.0, 702, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.packet_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.packet_list = list() #list of the date of the reception of the 3 packets !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L23_C1", "label": "getPortName", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "vector": [2, 1, 0.2136, 0.0182, 1, 0.61, 0.25, 34, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getPortName", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getPortName(self):\n\t\treturn self.port"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L24_C2", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L23_C1", "vector": [13, 2, 0.2182, 0.0091, 2, 0.76, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.port"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L26_C1", "label": "getIndex", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "vector": [2, 1, 0.2409, 0.0182, 1, 0.61, 0.5, 634, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getIndex", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getIndex(self):\n\t\treturn len(self.packet_list)-1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L26_C1", "vector": [13, 2, 0.2455, 0.0091, 2, 0.7, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn len(self.packet_list)-1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L29_C1", "label": "addElement", "type": "function", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "vector": [2, 1, 0.2727, 0.0273, 1, 0.61, 0.75, 475, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addElement", "arg_names": ["self", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef addElement(self,time):\n\t\tif len(self.packet_list) < 3:\n\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L30_C2", "label": "if", "type": "if", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L29_C1", "vector": [4, 2, 0.2773, 0.0182, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif len(self.packet_list) < 3:\n\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L31_C3", "label": "append()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L30_C2", "vector": [8, 3, 0.2818, 0.0091, 3, 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": "\t\t\tself.packet_list.append(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L33_C1", "label": "getElement", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "vector": [2, 1, 0.3045, 0.0182, 1, 0.61, 1.0, 274, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "getElement", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getElement(self,i):\n\t\treturn self.packet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L34_C2", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L33_C1", "vector": [13, 2, 0.3091, 0.0091, 2, 0.83, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.packet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "label": "SuspectIP", "type": "class", "loc": [37, 69], "level": 0, "parent": null, "vector": [3, 0, 0.4818, 0.3, 0, 0.66, 0.8889, 126, 0, 4, 0, 0, 0, 0, 26], "semantic": {"name": "SuspectIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SuspectIP:\n\tdef __init__(self,ip,time):\n\t\tself.ip = ip\n\t\tself.nbpacket = 0\n\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))\n\t\tself.firstpacket_received = time\n\t\tself.lastpacket_received = 0\n\t\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "label": "__init__", "type": "function", "loc": [38, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "vector": [2, 1, 0.3682, 0.0545, 1, 0.09, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "ip", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,ip,time):\n\t\tself.ip = ip\n\t\tself.nbpacket = 0\n\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))\n\t\tself.firstpacket_received = time\n\t\tself.lastpacket_received = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L39_C2", "label": "self.ip =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "vector": [14, 2, 0.3545, 0.0091, 2, 0.21, 0.0, 225, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.ip = ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L40_C2", "label": "self.nbpacket =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "vector": [14, 2, 0.3636, 0.0091, 2, 0.21, 0.25, 569, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.nbpacket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.nbpacket = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L41_C2", "label": "self.triplet_list = list()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "vector": [14, 2, 0.3727, 0.0091, 2, 0.21, 0.5, 449, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.triplet_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.triplet_list = list()\t#List of triplet (normally maximum 10 triplets (3*10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L42_C2", "label": "self.firstpacket_received =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "vector": [14, 2, 0.3818, 0.0091, 2, 0.21, 0.75, 499, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.firstpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.firstpacket_received = time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L43_C2", "label": "self.lastpacket_received =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "vector": [14, 2, 0.3909, 0.0091, 2, 0.21, 1.0, 145, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.lastpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastpacket_received = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L45_C1", "label": "getIP", "type": "function", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "vector": [2, 1, 0.4136, 0.0182, 1, 0.09, 0.3333, 134, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getIP", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getIP(self):\n\t\treturn self.ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L45_C1", "vector": [13, 2, 0.4182, 0.0091, 2, 0.71, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L48_C1", "label": "getLastPacketDate", "type": "function", "loc": [48, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "vector": [2, 1, 0.4409, 0.0182, 1, 0.09, 0.6667, 964, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getLastPacketDate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getLastPacketDate(self):\n\t\treturn self.lastpacket_received"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L49_C2", "label": "return", "type": "return", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L48_C1", "vector": [13, 2, 0.4455, 0.0091, 2, 0.13, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.lastpacket_received"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "label": "addPacket", "type": "function", "loc": [51, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "vector": [2, 1, 0.5455, 0.1727, 1, 0.09, 1.0, 940, 0, 3, 0, 0, 0, 0, 25], "semantic": {"name": "addPacket", "arg_names": ["self", "port", "time_recep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef addPacket(self,port,time_recep):\n\t\tself.lastpacket_received = time_recep\n\t\texist = False\n\t\tfor i in range(len(self.triplet_list)):\t\t\t\t#check all element of the list of suspect\n\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L52_C2", "label": "self.lastpacket_received =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "vector": [14, 2, 0.4727, 0.0091, 2, 0.09, 0.0, 145, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lastpacket_received", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastpacket_received = time_recep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L53_C2", "label": "exist =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "vector": [14, 2, 0.4818, 0.0091, 2, 0.09, 0.3333, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\texist = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:For_L54_C2", "label": "for i", "type": "for", "loc": [54, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "vector": [6, 2, 0.5318, 0.0909, 2, 0.09, 0.6667, 826, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in range(len(self.triplet_list)):\t\t\t\t#check all element of the list of suspect\n\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet\n\t\t\t\tindex = cur.getIndex()\n\t\t\t\tself.nbpacket += 1\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "label": "if", "type": "if", "loc": [55, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:For_L54_C2", "vector": [4, 3, 0.5364, 0.0818, 3, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.triplet_list[i].getPortName() == port:\t#if already in the list\n\t\t\t\texist = True\n\t\t\t\tcur = self.triplet_list[i]\n\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet\n\t\t\t\tindex = cur.getIndex()\n\t\t\t\tself.nbpacket += 1\n\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))\n\t\t\t\tif self.nbpacket == 30:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L56_C4", "label": "exist =", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [14, 4, 0.5091, 0.0091, 4, 0.81, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\texist = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L57_C4", "label": "cur =", "type": "assigned_variable", "loc": [57, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [14, 4, 0.5182, 0.0091, 4, 0.81, 0.2, 834, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tcur = self.triplet_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L58_C4", "label": "addElement()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [8, 4, 0.5273, 0.0091, 4, 0.81, 0.4, 475, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addElement", "arg_names": [], "import_names": [], "rhs_call_name": "addElement", "annotation": ""}, "snippet": "\t\t\t\tcur.addElement(time_recep)\t#add element to the triplet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L59_C4", "label": "index = getIndex()", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [14, 4, 0.5364, 0.0091, 4, 0.81, 0.6, 780, 3, 0, 0, 0, 634, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "getIndex", "annotation": ""}, "snippet": "\t\t\t\tindex = cur.getIndex()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L61_C4", "label": "print()", "type": "expression", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [8, 4, 0.5545, 0.0091, 4, 0.81, 0.8, 535, 3, 2, 0, 0, 0, 0, 9], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(%s/3) BOTNET packet Date:%s(difference:%s) Total count:%s\" %\t(self.ip,cur.getPortName(),index+1, datetime.fromtimestamp(cur.getElement(index)).strftime(\"%H:%M:%S\"), cur.getElement(index) - cur.getElement(index-1),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "vector": [4, 4, 0.5682, 0.0182, 4, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.nbpacket == 30:\n\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s all packet from botnet signature detected in %s seconds\" % (self.ip, self.lastpacket_received - self.firstpacket_received))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L63_C5", "label": "print()", "type": "expression", "loc": [63, 63], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L62_C4", "vector": [8, 5, 0.5727, 0.0091, 5, 0.66, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s all packet from botnet signature detected in %s seconds\" % (self.ip, self.lastpacket_received - self.firstpacket_received))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "label": "if", "type": "if", "loc": [64, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "vector": [4, 2, 0.6045, 0.0545, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not exist:\n\t\t\tnew = Triplet(port)\t\t#Creation of the new suspect and push it in the list\n\t\t\tnew.addElement(time_recep)\n\t\t\tself.nbpacket += 1\n\t\t\tself.triplet_list.append(new)\n\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s\" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime(\"%H:%M:%S\"),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L65_C3", "label": "new = Triplet()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "vector": [14, 3, 0.5909, 0.0091, 3, 0.16, 0.0, 145, 3, 1, 0, 0, 707, 10, 1], "semantic": {"name": "new", "arg_names": [], "import_names": [], "rhs_call_name": "Triplet", "annotation": ""}, "snippet": "\t\t\tnew = Triplet(port)\t\t#Creation of the new suspect and push it in the list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L66_C3", "label": "addElement()", "type": "expression", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "vector": [8, 3, 0.6, 0.0091, 3, 0.16, 0.3333, 475, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addElement", "arg_names": [], "import_names": [], "rhs_call_name": "addElement", "annotation": ""}, "snippet": "\t\t\tnew.addElement(time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L68_C3", "label": "append()", "type": "expression", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "vector": [8, 3, 0.6182, 0.0091, 3, 0.16, 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\tself.triplet_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L69_C3", "label": "print()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "vector": [8, 3, 0.6273, 0.0091, 3, 0.16, 1.0, 535, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),\"IP:%s Port:%s(1/3) BOTNET packet Date:%s Total count:%s\" % (self.ip,port,datetime.fromtimestamp(time_recep).strftime(\"%H:%M:%S\"),self.nbpacket))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "label": "botnet", "type": "class", "loc": [75, 110], "level": 0, "parent": null, "vector": [3, 0, 0.8409, 0.3273, 0, 0.66, 1.0, 761, 0, 4, 0, 0, 0, 0, 25], "semantic": {"name": "botnet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class botnet:\n\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.suspect_list = list()\n\t\t\n\tdef analyse(self, data,time_recep):\n\t\tif isIP(data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "label": "__init__", "type": "function", "loc": [76, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "vector": [2, 1, 0.7045, 0.0364, 1, 0.26, 0.0, 555, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.suspect_list = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L77_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "vector": [14, 2, 0.7, 0.0091, 2, 0.83, 0.0, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L78_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "vector": [14, 2, 0.7091, 0.0091, 2, 0.83, 0.5, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L79_C2", "label": "self.suspect_list = list()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "vector": [14, 2, 0.7182, 0.0091, 2, 0.83, 1.0, 273, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.suspect_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.suspect_list = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1", "label": "analyse", "type": "function", "loc": [81, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "vector": [2, 1, 0.7818, 0.1, 1, 0.26, 0.3333, 15, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "analyse", "arg_names": ["self", "data", "time_recep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data,time_recep):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\tsrcip = getSrcIp(self.ip_packet)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "label": "if", "type": "if", "loc": [82, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1", "vector": [4, 2, 0.7818, 0.0818, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\tsrcip = getSrcIp(self.ip_packet)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L83_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "vector": [14, 3, 0.7545, 0.0091, 3, 0.92, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L84_C3", "label": "srcip = getSrcIp()", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "vector": [14, 3, 0.7636, 0.0091, 3, 0.92, 0.5, 210, 3, 1, 0, 0, 792, 10, 1], "semantic": {"name": "srcip", "arg_names": [], "import_names": [], "rhs_call_name": "getSrcIp", "annotation": ""}, "snippet": "\t\t\tsrcip = getSrcIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3", "label": "if", "type": "if", "loc": [86, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "vector": [4, 3, 0.8, 0.0455, 3, 0.92, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements\n\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L87_C4", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3", "vector": [14, 4, 0.7909, 0.0091, 4, 0.74, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L89_C4", "label": "if", "type": "if", "loc": [89, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3", "vector": [4, 4, 0.8136, 0.0182, 4, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.tcp_packet.get_th_dport() == 1013 and getDstIp(self.ip_packet) == \"192.168.5.13\" and getDecFlagsValue(self.tcp_packet) == 2: #if the packet matches all requirements\n\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L90_C5", "label": "processPacket()", "type": "expression", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L89_C4", "vector": [8, 5, 0.8182, 0.0091, 5, 0.11, 0.0, 826, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "processPacket", "arg_names": [], "import_names": [], "rhs_call_name": "processPacket", "annotation": ""}, "snippet": "\t\t\t\t\tself.processPacket(srcip,self.tcp_packet.get_th_sport(),time_recep)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L91_C2", "label": "update_list()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1", "vector": [8, 2, 0.8273, 0.0091, 2, 0.67, 1.0, 886, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_list", "arg_names": [], "import_names": [], "rhs_call_name": "update_list", "annotation": ""}, "snippet": "\t\tself.update_list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "label": "processPacket", "type": "function", "loc": [94, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "vector": [2, 1, 0.8955, 0.0909, 1, 0.26, 0.6667, 826, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "processPacket", "arg_names": ["self", "ip", "port", "rec_time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef processPacket(self, ip,port,rec_time):\n\t\texist = False\n\t\tfor suspect in self.suspect_list:\n\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)\n\t\tif not exist:\n\t\t\tnew = SuspectIP(ip,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L95_C2", "label": "exist =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "vector": [14, 2, 0.8636, 0.0091, 2, 0.05, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\texist = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:For_L96_C2", "label": "for suspect", "type": "for", "loc": [96, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "vector": [6, 2, 0.8864, 0.0364, 2, 0.05, 0.5, 780, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "suspect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor suspect in self.suspect_list:\n\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3", "label": "if", "type": "if", "loc": [97, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:For_L96_C2", "vector": [4, 3, 0.8909, 0.0273, 3, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif suspect.getIP() == ip:\n\t\t\t\texist = True\n\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L98_C4", "label": "exist =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3", "vector": [14, 4, 0.8909, 0.0091, 4, 0.36, 0.0, 305, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "exist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\texist = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L99_C4", "label": "addPacket()", "type": "expression", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3", "vector": [8, 4, 0.9, 0.0091, 4, 0.36, 1.0, 940, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addPacket", "arg_names": [], "import_names": [], "rhs_call_name": "addPacket", "annotation": ""}, "snippet": "\t\t\t\tsuspect.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "label": "if", "type": "if", "loc": [100, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "vector": [4, 2, 0.9227, 0.0364, 2, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not exist:\n\t\t\tnew = SuspectIP(ip,rec_time)\n\t\t\tnew.addPacket(port,rec_time)\n\t\t\tself.suspect_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L101_C3", "label": "new = SuspectIP()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "vector": [14, 3, 0.9182, 0.0091, 3, 0.75, 0.0, 145, 3, 2, 0, 0, 126, 10, 1], "semantic": {"name": "new", "arg_names": [], "import_names": [], "rhs_call_name": "SuspectIP", "annotation": ""}, "snippet": "\t\t\tnew = SuspectIP(ip,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L102_C3", "label": "addPacket()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "vector": [8, 3, 0.9273, 0.0091, 3, 0.75, 0.5, 940, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addPacket", "arg_names": [], "import_names": [], "rhs_call_name": "addPacket", "annotation": ""}, "snippet": "\t\t\tnew.addPacket(port,rec_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L103_C3", "label": "append()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "vector": [8, 3, 0.9364, 0.0091, 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": "\t\t\tself.suspect_list.append(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L105_C1", "label": "update_list", "type": "function", "loc": [105, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "vector": [2, 1, 0.9773, 0.0545, 1, 0.26, 1.0, 886, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "update_list", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef update_list(self):\n\t\tfor i in range(len(self.suspect_list)):\n\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:For_L106_C2", "label": "for i", "type": "for", "loc": [106, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L105_C1", "vector": [6, 2, 0.9818, 0.0455, 2, 0.44, 0.0, 826, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in range(len(self.suspect_list)):\n\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:If_L107_C3", "label": "if", "type": "if", "loc": [107, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:For_L106_C2", "vector": [4, 3, 0.9864, 0.0364, 3, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (time.time() - self.suspect_list[i].getLastPacketDate()) > 240:\n\t\t\t\t#if the last packet of the host is older than 4 minutes\n\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")\n\t\t\t\tdel self.suspect_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L109_C4", "label": "print()", "type": "expression", "loc": [109, 109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_34:If_L107_C3", "vector": [8, 4, 0.9909, 0.0091, 4, 0.98, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\tprint(self.suspect_list[i].getIP(),\" reseted (botnet)\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L26_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L33_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L48_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L48_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Return_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:For_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:For_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L55_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L63_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L51_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L66_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L69_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L76_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L83_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L86_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L90_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L81_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:For_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:For_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L94_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Assign_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L102_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L103_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L105_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:FunctionDef_L105_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_34:For_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_34:If_L107_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_34:If_L107_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_34:Expr_L109_C4"}]
#!/usr/bin/python # -*- coding: utf-8 -*- #-----------------------------------# #Author: Robin David #Matriculation: 10014500 #License: Creative Commons #-----------------------------------# import string from impacket import ImpactDecoder, ImpactPacket #packet manipulation module from datetime import datetime import time import re #regular expression from email.parser import Parser #parser for mime type ! from packet_function import * class BBC: def __init__(self): self.ip_packet = list() self.tcp_packet = list() self.lastmessage = "" def analyse(self, data): if isIP(data): self.ip_packet = getIPPacket(data) if isTCP(self.ip_packet): self.tcp_packet = getTCPorUDPPacket(self.ip_packet) if self.tcp_packet.get_th_dport() == 1935: data = self.tcp_packet.get_data_as_string() if re.search("www..?bbc.c.?o.uk",data): #if pattern found then try to pick up path of stream url_path = re.findall("(?!www\.bbc\/c.?o\.uk).*www\..?bbc\.co\.uk(.*)...$",data)[0] ip = getSrcIp(self.ip_packet) mess = "IP:%s\t Stream:www.bbc.co.uk%s" % (ip,url_path) if mess != self.lastmessage: #avoid redundancy of message for same request and same ip print datetime.now().strftime("%b %d, %H:%M:%S"),mess self.lastmessage = mess
ajibawa-2023/Python-Code-Large/train/row_36
26
40
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_36:Import_L8_C0", "label": "string import string", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.025, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:ImportFrom_L9_C0", "label": "from impacket import ImpactDecoder, ImpactPacket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.225, 0.025, 0, 0.66, 0.1429, 752, 0, 2, 0, 0, 752, 0, 0], "semantic": {"name": "impacket", "arg_names": [], "import_names": ["ImpactDecoder", "ImpactPacket"], "rhs_call_name": "", "annotation": ""}, "snippet": "from impacket import ImpactDecoder, ImpactPacket #packet manipulation module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.025, 0, 0.66, 0.2857, 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_36:Import_L11_C0", "label": "time import time", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.275, 0.025, 0, 0.66, 0.4286, 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_36:Import_L12_C0", "label": "re import re", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.025, 0, 0.66, 0.5714, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re #regular expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:ImportFrom_L13_C0", "label": "from email.parser import Parser", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.325, 0.025, 0, 0.66, 0.7143, 799, 0, 1, 0, 0, 799, 0, 0], "semantic": {"name": "email.parser", "arg_names": [], "import_names": ["Parser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from email.parser import Parser #parser for mime type !"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:ImportFrom_L15_C0", "label": "from packet_function import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.375, 0.025, 0, 0.66, 0.8571, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "packet_function", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from packet_function import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:ClassDef_L18_C0", "label": "BBC", "type": "class", "loc": [18, 40], "level": 0, "parent": null, "vector": [3, 0, 0.725, 0.575, 0, 0.66, 1.0, 547, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "BBC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BBC:\n\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.lastmessage = \"\"\n\t\t\n\tdef analyse(self, data):\n\t\tif isIP(data):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "label": "__init__", "type": "function", "loc": [19, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:ClassDef_L18_C0", "vector": [2, 1, 0.5125, 0.1, 1, 0.73, 0.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self):\n\t\tself.ip_packet = list()\n\t\tself.tcp_packet = list()\n\t\tself.lastmessage = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L20_C2", "label": "self.ip_packet = list()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "vector": [14, 2, 0.5, 0.025, 2, 0.79, 0.0, 68, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.ip_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L21_C2", "label": "self.tcp_packet = list()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "vector": [14, 2, 0.525, 0.025, 2, 0.79, 0.5, 856, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": "\t\tself.tcp_packet = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L22_C2", "label": "self.lastmessage =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "vector": [14, 2, 0.55, 0.025, 2, 0.79, 1.0, 654, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.lastmessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.lastmessage = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L24_C1", "label": "analyse", "type": "function", "loc": [24, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:ClassDef_L18_C0", "vector": [2, 1, 0.8, 0.425, 1, 0.73, 1.0, 15, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "analyse", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef analyse(self, data):\n\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2", "label": "if", "type": "if", "loc": [25, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L24_C1", "vector": [4, 2, 0.8125, 0.4, 2, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif isIP(data):\n\t\t\tself.ip_packet = getIPPacket(data)\n\t\t\t\n\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L26_C3", "label": "self.ip_packet = getIPPacket()", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2", "vector": [14, 3, 0.65, 0.025, 3, 0.79, 0.0, 68, 3, 1, 0, 0, 519, 10, 1], "semantic": {"name": "self.ip_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getIPPacket", "annotation": ""}, "snippet": "\t\t\tself.ip_packet = getIPPacket(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3", "label": "if", "type": "if", "loc": [28, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2", "vector": [4, 3, 0.85, 0.325, 3, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif isTCP(self.ip_packet):\n\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)\n\t\t\t\t\n\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()\n\n\t\t\t\t\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L29_C4", "label": "self.tcp_packet = getTCPorUDPPacket()", "type": "assigned_variable", "loc": [29, 29], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3", "vector": [14, 4, 0.725, 0.025, 4, 0.49, 0.0, 856, 3, 1, 0, 0, 472, 10, 1], "semantic": {"name": "self.tcp_packet", "arg_names": [], "import_names": [], "rhs_call_name": "getTCPorUDPPacket", "annotation": ""}, "snippet": "\t\t\t\tself.tcp_packet = getTCPorUDPPacket(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4", "label": "if", "type": "if", "loc": [31, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3", "vector": [4, 4, 0.8875, 0.25, 4, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif self.tcp_packet.get_th_dport() == 1935:\n\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()\n\n\t\t\t\t\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]\n\t\t\t\t\t\tip = getSrcIp(self.ip_packet)\n\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)\n\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L32_C5", "label": "data = get_data_as_string()", "type": "assigned_variable", "loc": [32, 32], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4", "vector": [14, 5, 0.8, 0.025, 5, 0.43, 0.0, 929, 3, 0, 0, 0, 251, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_data_as_string", "annotation": ""}, "snippet": "\t\t\t\t\tdata = self.tcp_packet.get_data_as_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "label": "if", "type": "if", "loc": [34, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4", "vector": [4, 5, 0.925, 0.175, 5, 0.43, 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\tif re.search(\"www..?bbc.c.?o.uk\",data):\t\t#if pattern found then try to pick up path of stream\n\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]\n\t\t\t\t\t\tip = getSrcIp(self.ip_packet)\n\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)\n\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip\n\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)\n\t\t\t\t\t\t\tself.lastmessage = mess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L35_C6", "label": "url_path =", "type": "assigned_variable", "loc": [35, 35], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "vector": [14, 6, 0.875, 0.025, 6, 0.69, 0.0, 872, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "url_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\turl_path = re.findall(\"(?!www\\.bbc\\/c.?o\\.uk).*www\\..?bbc\\.co\\.uk(.*)...$\",data)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L36_C6", "label": "ip = getSrcIp()", "type": "assigned_variable", "loc": [36, 36], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "vector": [14, 6, 0.9, 0.025, 6, 0.69, 0.3333, 583, 3, 1, 0, 0, 792, 10, 1], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "getSrcIp", "annotation": ""}, "snippet": "\t\t\t\t\t\tip = getSrcIp(self.ip_packet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L37_C6", "label": "mess =", "type": "assigned_variable", "loc": [37, 37], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "vector": [14, 6, 0.925, 0.025, 6, 0.69, 0.6667, 364, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\tmess = \"IP:%s\\t Stream:www.bbc.co.uk%s\" % (ip,url_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6", "label": "if", "type": "if", "loc": [38, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "vector": [4, 6, 0.975, 0.075, 6, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\tif mess != self.lastmessage:\t#avoid redundancy of message for same request and same ip\n\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)\n\t\t\t\t\t\t\tself.lastmessage = mess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Expr_L39_C7", "label": "print()", "type": "expression", "loc": [39, 39], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6", "vector": [8, 7, 0.975, 0.025, 7, 0.64, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\t\t\t\t\t\tprint(datetime.now().strftime(\"%b %d, %H:%M:%S\"),mess)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L40_C7", "label": "self.lastmessage =", "type": "assigned_variable", "loc": [40, 40], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6", "vector": [14, 7, 1.0, 0.025, 7, 0.64, 1.0, 654, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lastmessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\t\t\tself.lastmessage = mess"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_36:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:FunctionDef_L24_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L26_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L28_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L32_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L35_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L36_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L37_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L34_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Expr_L39_C7"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_36:If_L38_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_36:Assign_L40_C7"}]
#!/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_38
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_38: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_38: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_38: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_38: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_38: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_38: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_38: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_38: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_38:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:ClassDef_L31_C0", "vector": [2, 1, 0.3367, 0.0306, 1, 0.44, 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_38:Assign_L33_C8", "label": "self.license_text =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L32_C4", "vector": [14, 2, 0.3367, 0.0102, 2, 0.4, 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_38:Assign_L34_C8", "label": "self.filenames =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L32_C4", "vector": [14, 2, 0.3469, 0.0102, 2, 0.4, 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_38:FunctionDef_L37_C4", "label": "add_file", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:ClassDef_L31_C0", "vector": [2, 1, 0.3878, 0.0306, 1, 0.44, 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_38:If_L38_C8", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L37_C4", "vector": [4, 2, 0.3929, 0.0204, 2, 0.43, 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_38:Expr_L39_C12", "label": "append()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L38_C8", "vector": [8, 3, 0.398, 0.0102, 3, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38: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_38: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_38:Assign_L48_C4", "label": "license_key = lower()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "vector": [14, 1, 0.4898, 0.0102, 1, 0.96, 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_38:If_L49_C4", "label": "if", "type": "if", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "vector": [4, 1, 0.5051, 0.0204, 1, 0.96, 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_38:Assign_L50_C8", "label": " = License()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L49_C4", "vector": [14, 2, 0.5102, 0.0102, 2, 0.75, 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_38:Return_L51_C4", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "vector": [13, 1, 0.5204, 0.0102, 1, 0.96, 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_38: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_38:If_L57_C4", "label": "if", "type": "if", "loc": [57, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "vector": [4, 1, 0.6122, 0.0714, 1, 0.27, 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_38:Assign_L59_C12", "label": "license_text = read()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "vector": [14, 2, 0.602, 0.0102, 2, 0.07, 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_38:Assign_L60_C8", "label": "target_filename =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "vector": [14, 2, 0.6122, 0.0102, 2, 0.07, 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_38:If_L61_C8", "label": "if", "type": "if", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "vector": [4, 2, 0.6224, 0.0102, 2, 0.07, 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_38:Assign_L61_C42", "label": "target_filename =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L61_C8", "vector": [14, 3, 0.6224, 0.0102, 3, 0.31, 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_38:Expr_L62_C8", "label": "add_file()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "vector": [8, 2, 0.6327, 0.0102, 2, 0.07, 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_38:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "vector": [13, 2, 0.6429, 0.0102, 2, 0.07, 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_38:Assign_L66_C4", "label": "mimetype = guess_type()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "vector": [14, 1, 0.6735, 0.0102, 1, 0.27, 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_38:If_L67_C4", "label": "if", "type": "if", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "vector": [4, 1, 0.6837, 0.0102, 1, 0.27, 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_38:Return_L67_C34", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:If_L67_C4", "vector": [13, 2, 0.6837, 0.0102, 2, 0.8, 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_38:Assign_L70_C8", "label": "raw_file = read()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "vector": [14, 1, 0.7143, 0.0102, 1, 0.27, 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_38:For_L73_C4", "label": "for comment", "type": "for", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "vector": [6, 1, 0.7653, 0.051, 1, 0.27, 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_38:Assign_L74_C8", "label": "comment = group()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "vector": [14, 2, 0.7551, 0.0102, 2, 0.6, 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_38:If_L75_C8", "label": "if", "type": "if", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "vector": [4, 2, 0.7653, 0.0102, 2, 0.6, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_LICENSE.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38:If_L76_C8", "label": "if", "type": "if", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "vector": [4, 2, 0.7755, 0.0102, 2, 0.6, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_COPYRIGHT.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L77_C8", "label": "add_file()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "vector": [8, 2, 0.7857, 0.0102, 2, 0.6, 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_38: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_38:For_L81_C4", "label": "for root, dirs, files", "type": "for", "loc": [81, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L80_C0", "vector": [6, 1, 0.8367, 0.0306, 1, 0.86, 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_38:For_L82_C8", "label": "for name", "type": "for", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L81_C4", "vector": [6, 2, 0.8418, 0.0204, 2, 0.95, 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_38:Expr_L83_C12", "label": "discover_license()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L82_C8", "vector": [8, 3, 0.8469, 0.0102, 3, 0.47, 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_38: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_38: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_38:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [8, 1, 0.9184, 0.0102, 1, 0.99, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<h3>Notices for files:</h3><ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L91_C4", "label": "filenames =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [14, 1, 0.9286, 0.0102, 1, 0.99, 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_38:Expr_L92_C4", "label": "sort()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [8, 1, 0.9388, 0.0102, 1, 0.99, 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_38:For_L93_C4", "label": "for filename", "type": "for", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [6, 1, 0.9541, 0.0204, 1, 0.99, 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_38:Expr_L94_C8", "label": "print()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L93_C4", "vector": [8, 2, 0.9592, 0.0102, 2, 0.98, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<li>%s</li>\" % (filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [8, 1, 0.9694, 0.0102, 1, 0.99, 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_38:Expr_L96_C4", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "vector": [8, 1, 0.9796, 0.0102, 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(\"<pre>%s</pre>\" % license.license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_38: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_38:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Return_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L61_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Return_L67_C34"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:For_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:For_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_38:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_38:Expr_L96_C4"}]
#! /usr/bin/python # $Id: testupnpigd.py,v 1.4 2008/10/11 10:27:20 nanard Exp $ # MiniUPnP project # Author : Thomas Bernard # This Sample code is public domain. # website : http://miniupnp.tuxfamily.org/ # import the python miniupnpc module import miniupnpc import socket import BaseHTTPServer # function definition def list_redirections(): i = 0 while True: p = u.getgenericportmapping(i) if p==None: break print i, p i = i + 1 #define the handler class for HTTP connections class handler_class(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.end_headers() self.wfile.write("OK MON GARS") # create the object u = miniupnpc.UPnP() #print 'inital(default) values :' #print ' discoverdelay', u.discoverdelay #print ' lanaddr', u.lanaddr #print ' multicastif', u.multicastif #print ' minissdpdsocket', u.minissdpdsocket u.discoverdelay = 200; try: print 'Discovering... delay=%ums' % u.discoverdelay ndevices = u.discover() print ndevices, 'device(s) detected' # select an igd u.selectigd() # display information about the IGD and the internet connection print 'local ip address :', u.lanaddr externalipaddress = u.externalipaddress() print 'external ip address :', externalipaddress print u.statusinfo(), u.connectiontype() #instanciate a HTTPd object. The port is assigned by the system. httpd = BaseHTTPServer.HTTPServer((u.lanaddr, 0), handler_class) eport = httpd.server_port # find a free port for the redirection r = u.getspecificportmapping(eport, 'TCP') while r != None and eport < 65536: eport = eport + 1 r = u.getspecificportmapping(eport, 'TCP') print 'trying to redirect %s port %u TCP => %s port %u TCP' % (externalipaddress, eport, u.lanaddr, httpd.server_port) b = u.addportmapping(eport, 'TCP', u.lanaddr, httpd.server_port, 'UPnP IGD Tester port %u' % eport, '') if b: print 'Success. Now waiting for some HTTP request on http://%s:%u' % (externalipaddress ,eport) try: httpd.handle_request() httpd.server_close() except KeyboardInterrupt, details: print "CTRL-C exception!", details b = u.deleteportmapping(eport, 'TCP') if b: print 'Successfully deleted port mapping' else: print 'Failed to remove port mapping' else: print 'Failed' httpd.server_close() except Exception, e: print 'Exception :', e
ajibawa-2023/Python-Code-Large/train/row_39
15
19
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_39:Import_L1_C0", "label": "miniupnpc import miniupnpc", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 772, 0, 1, 0, 0, 772, 0, 0], "semantic": {"name": "miniupnpc", "arg_names": [], "import_names": ["miniupnpc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import miniupnpc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Import_L2_C0", "label": "socket import socket", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.25, 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_39:Import_L3_C0", "label": "BaseHTTPServer import BaseHTTPServer", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0526, 0, 0.66, 0.5, 801, 0, 1, 0, 0, 801, 0, 0], "semantic": {"name": "BaseHTTPServer", "arg_names": [], "import_names": ["BaseHTTPServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "import BaseHTTPServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L5_C0", "label": "list_redirections", "type": "function", "loc": [5, 12], "level": 0, "parent": null, "vector": [2, 0, 0.4474, 0.4211, 0, 0.66, 0.75, 525, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "list_redirections", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def list_redirections():\n\ti = 0\n\twhile True:\n\t\tp = u.getgenericportmapping(i)\n\t\tif p==None:\n\t\t\tbreak\n\t\tprint(i, p)\n\t\ti = i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L6_C1", "label": "i =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L5_C0", "vector": [14, 1, 0.3158, 0.0526, 1, 0.5, 0.0, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ti = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "label": "while", "type": "while", "loc": [7, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L5_C0", "vector": [5, 1, 0.5, 0.3158, 1, 0.5, 1.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile True:\n\t\tp = u.getgenericportmapping(i)\n\t\tif p==None:\n\t\t\tbreak\n\t\tprint(i, p)\n\t\ti = i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L8_C2", "label": "p = getgenericportmapping()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "vector": [14, 2, 0.4211, 0.0526, 2, 0.48, 0.0, 491, 3, 1, 0, 0, 439, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "getgenericportmapping", "annotation": ""}, "snippet": "\t\tp = u.getgenericportmapping(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:If_L9_C2", "label": "if", "type": "if", "loc": [9, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "vector": [4, 2, 0.5, 0.1053, 2, 0.48, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif p==None:\n\t\t\tbreak"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L11_C2", "label": "print()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "vector": [8, 2, 0.5789, 0.0526, 2, 0.48, 0.6667, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(i, p)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L12_C2", "label": "i =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "vector": [14, 2, 0.6316, 0.0526, 2, 0.48, 1.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ti = i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:ClassDef_L14_C0", "label": "handler_class", "type": "class", "loc": [14, 18], "level": 0, "parent": null, "vector": [3, 0, 0.8421, 0.2632, 0, 0.66, 1.0, 19, 0, 1, 0, 0, 814, 0, 3], "semantic": {"name": "handler_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class handler_class(BaseHTTPServer.BaseHTTPRequestHandler):\n\tdef do_GET(self):\n\t\tself.send_response(200)\n\t\tself.end_headers()\n\t\tself.wfile.write(\"OK MON GARS\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "label": "do_GET", "type": "function", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:ClassDef_L14_C0", "vector": [2, 1, 0.8684, 0.2105, 1, 0.54, 0.0, 269, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "do_GET", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef do_GET(self):\n\t\tself.send_response(200)\n\t\tself.end_headers()\n\t\tself.wfile.write(\"OK MON GARS\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L16_C2", "label": "send_response()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "vector": [8, 2, 0.8421, 0.0526, 2, 0.75, 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": "\t\tself.send_response(200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L17_C2", "label": "end_headers()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "vector": [8, 2, 0.8947, 0.0526, 2, 0.75, 0.5, 683, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_headers", "arg_names": [], "import_names": [], "rhs_call_name": "end_headers", "annotation": ""}, "snippet": "\t\tself.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L18_C2", "label": "write()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "vector": [8, 2, 0.9474, 0.0526, 2, 0.75, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\tself.wfile.write(\"OK MON GARS\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:If_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:While_L7_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_39:FunctionDef_L15_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_39:Expr_L18_C2"}]
#! /usr/bin/python # $Id: setup.py,v 1.3 2009/04/17 20:59:42 nanard Exp $ # the MiniUPnP Project (c) 2007 Thomas Bernard # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # # python script to build the miniupnpc module under unix # # replace libminiupnpc.a by libminiupnpc.so for shared library usage from distutils.core import setup, Extension setup(name="miniupnpc", version="1.3", ext_modules=[ Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], extra_objects=["libminiupnpc.a"]) ])
ajibawa-2023/Python-Code-Large/train/row_40
2
15
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_40:ImportFrom_L9_C0", "label": "from distutils.core import setup, Extension", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.6, 0.0667, 0, 0.66, 0.0, 152, 0, 2, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup", "Extension"], "rhs_call_name": "", "annotation": ""}, "snippet": "from distutils.core import setup, Extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_40:Expr_L10_C0", "label": "setup()", "type": "expression", "loc": [10, 14], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.3333, 0, 0.66, 1.0, 234, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(name=\"miniupnpc\", version=\"1.3\",\n ext_modules=[\n\t Extension(name=\"miniupnpc\", sources=[\"miniupnpcmodule.c\"],\n\t\t\t extra_objects=[\"libminiupnpc.a\"])\n\t\t\t ])"}]
[]
#! /usr/bin/python # $Id: setupmingw32.py,v 1.1 2007/06/12 23:04:13 nanard Exp $ # the MiniUPnP Project (c) 2007 Thomas Bernard # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # # python script to build the miniupnpc module under unix # from distutils.core import setup, Extension setup(name="miniupnpc", version="1.0-RC6", ext_modules=[ Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], libraries=["ws2_32"], extra_objects=["libminiupnpc.a"]) ])
ajibawa-2023/Python-Code-Large/train/row_41
2
15
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_41:ImportFrom_L8_C0", "label": "from distutils.core import setup, Extension", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.5333, 0.0667, 0, 0.66, 0.0, 152, 0, 2, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup", "Extension"], "rhs_call_name": "", "annotation": ""}, "snippet": "from distutils.core import setup, Extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_41:Expr_L9_C0", "label": "setup()", "type": "expression", "loc": [9, 14], "level": 0, "parent": null, "vector": [8, 0, 0.7667, 0.4, 0, 0.66, 1.0, 234, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(name=\"miniupnpc\", version=\"1.0-RC6\",\n ext_modules=[\n\t Extension(name=\"miniupnpc\", sources=[\"miniupnpcmodule.c\"],\n\t libraries=[\"ws2_32\"],\n\t\t\t extra_objects=[\"libminiupnpc.a\"])\n\t\t\t ])"}]
[]
#! /usr/bin/python # MiniUPnP project # Author : Thomas Bernard # This Sample code is public domain. # website : http://miniupnp.tuxfamily.org/ # import the python miniupnpc module import miniupnpc import sys # create the object u = miniupnpc.UPnP() print 'inital(default) values :' print ' discoverdelay', u.discoverdelay print ' lanaddr', u.lanaddr print ' multicastif', u.multicastif print ' minissdpdsocket', u.minissdpdsocket u.discoverdelay = 200; #u.minissdpdsocket = '../minissdpd/minissdpd.sock' # discovery process, it usualy takes several seconds (2 seconds or more) print 'Discovering... delay=%ums' % u.discoverdelay print u.discover(), 'device(s) detected' # select an igd try: u.selectigd() except Exception, e: print 'Exception :', e sys.exit(1) # display information about the IGD and the internet connection print 'local ip address :', u.lanaddr print 'external ip address :', u.externalipaddress() print u.statusinfo(), u.connectiontype() #print u.addportmapping(64000, 'TCP', # '192.168.1.166', 63000, 'port mapping test', '') #print u.deleteportmapping(64000, 'TCP') port = 0 proto = 'UDP' # list the redirections : i = 0 while True: p = u.getgenericportmapping(i) if p==None: break print i, p (port, proto, (ihost,iport), desc, c, d, e) = p #print port, desc i = i + 1 print u.getspecificportmapping(port, proto)
ajibawa-2023/Python-Code-Large/train/row_42
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_42:Import_L1_C0", "label": "miniupnpc import miniupnpc", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 772, 0, 1, 0, 0, 772, 0, 0], "semantic": {"name": "miniupnpc", "arg_names": [], "import_names": ["miniupnpc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import miniupnpc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_42:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 1.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}]
[]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl except: from cgi import parse_qsl import oauth2 as oauth REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' consumer_key = None consumer_secret = None if consumer_key is None or consumer_secret is None: print 'You need to edit this script and provide values for the' print 'consumer_key and also consumer_secret.' print '' print 'The values you need come from Twitter - you need to register' print 'as a developer your "application". This is needed only until' print 'Twitter finishes the idea they have of a way to allow open-source' print 'based libraries to have a token that can be used to generate a' print 'one-time use key that will allow the library to make the request' print 'on your behalf.' print '' sys.exit(1) signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) oauth_client = oauth.Client(oauth_consumer) print 'Requesting temp token from Twitter' resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET') if resp['status'] != '200': print 'Invalid respond from Twitter requesting temp token: %s' % resp['status'] else: request_token = dict(parse_qsl(content)) print '' print 'Please visit this Twitter page and retrieve the pincode to be used' print 'in the next step to obtaining an Authentication Token:' print '' print '%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']) print '' pincode = raw_input('Pincode? ') token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret']) token.set_verifier(pincode) print '' print 'Generating and signing request for an access token' print '' oauth_client = oauth.Client(oauth_consumer, token) resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % pincode) access_token = dict(parse_qsl(content)) if resp['status'] != '200': print 'The request for a Token did not succeed: %s' % resp['status'] print access_token else: print 'Your Twitter Access Token key: %s' % access_token['oauth_token'] print ' Access Token secret: %s' % access_token['oauth_token_secret'] print ''
ajibawa-2023/Python-Code-Large/train/row_43
53
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_43:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1978, 0.011, 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_43:Import_L19_C0", "label": "sys import sys", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2088, 0.011, 0, 0.66, 0.0625, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Try_L22_C0", "label": "try", "type": "try", "loc": [22, 25], "level": 0, "parent": null, "vector": [7, 0, 0.2582, 0.044, 0, 0.66, 0.125, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from urlparse import parse_qsl\nexcept:\n from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:ImportFrom_L23_C2", "label": "from urlparse import parse_qsl", "type": "import", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:Try_L22_C0", "vector": [1, 1, 0.2527, 0.011, 1, 0.24, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from urlparse import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:ImportFrom_L25_C2", "label": "from cgi import parse_qsl", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:Try_L22_C0", "vector": [1, 1, 0.2747, 0.011, 1, 0.24, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Import_L27_C0", "label": "oauth2 import oauth", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2967, 0.011, 0, 0.66, 0.1875, 311, 0, 1, 0, 0, 311, 0, 0], "semantic": {"name": "oauth2", "arg_names": [], "import_names": ["oauth"], "rhs_call_name": "", "annotation": ""}, "snippet": "import oauth2 as oauth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L29_C0", "label": "REQUEST_TOKEN_URL =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.3187, 0.011, 0, 0.66, 0.25, 456, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REQUEST_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L30_C0", "label": "ACCESS_TOKEN_URL =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.3297, 0.011, 0, 0.66, 0.3125, 469, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ACCESS_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L31_C0", "label": "AUTHORIZATION_URL =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.3407, 0.011, 0, 0.66, 0.375, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUTHORIZATION_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L32_C0", "label": "SIGNIN_URL =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.3516, 0.011, 0, 0.66, 0.4375, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L34_C0", "label": "consumer_key =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3736, 0.011, 0, 0.66, 0.5, 353, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L35_C0", "label": "consumer_secret =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3846, 0.011, 0, 0.66, 0.5625, 734, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "label": "if", "type": "if", "loc": [38, 49], "level": 0, "parent": null, "vector": [4, 0, 0.478, 0.1319, 0, 0.66, 0.625, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if consumer_key is None or consumer_secret is None:\n print('You need to edit this script and provide values for the')\n print('consumer_key and also consumer_secret.')\n print('')\n print('The values you need come from Twitter - you need to register')\n print('as a developer your \"application\". This is needed only until')\n print('Twitter finishes the idea they have of a way to allow open-source')\n print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L39_C2", "label": "print()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4286, 0.011, 1, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('You need to edit this script and provide values for the')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L40_C2", "label": "print()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4396, 0.011, 1, 0.97, 0.1, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('consumer_key and also consumer_secret.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L41_C2", "label": "print()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4505, 0.011, 1, 0.97, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L42_C2", "label": "print()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4615, 0.011, 1, 0.97, 0.3, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The values you need come from Twitter - you need to register')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L43_C2", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4725, 0.011, 1, 0.97, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('as a developer your \"application\". This is needed only until')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4835, 0.011, 1, 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": " print('Twitter finishes the idea they have of a way to allow open-source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L45_C2", "label": "print()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.4945, 0.011, 1, 0.97, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L46_C2", "label": "print()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.5055, 0.011, 1, 0.97, 0.7, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('one-time use key that will allow the library to make the request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L47_C2", "label": "print()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.5165, 0.011, 1, 0.97, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('on your behalf.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L48_C2", "label": "print()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.5275, 0.011, 1, 0.97, 0.9, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L49_C2", "label": "exit()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "vector": [8, 1, 0.5385, 0.011, 1, 0.97, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L51_C0", "label": "signature_method_hmac_sha1 = SignatureMethod_HMAC_SHA1()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.5604, 0.011, 0, 0.66, 0.6875, 705, 3, 0, 0, 0, 948, 10, 1], "semantic": {"name": "signature_method_hmac_sha1", "arg_names": [], "import_names": [], "rhs_call_name": "SignatureMethod_HMAC_SHA1", "annotation": ""}, "snippet": "signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L52_C0", "label": "oauth_consumer = Consumer()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.011, 0, 0.66, 0.75, 316, 3, 2, 0, 0, 881, 10, 1], "semantic": {"name": "oauth_consumer", "arg_names": [], "import_names": [], "rhs_call_name": "Consumer", "annotation": ""}, "snippet": "oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L53_C0", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.5824, 0.011, 0, 0.66, 0.8125, 671, 3, 1, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": "oauth_client = oauth.Client(oauth_consumer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L55_C0", "label": "print()", "type": "expression", "loc": [55, 55], "level": 0, "parent": null, "vector": [8, 0, 0.6044, 0.011, 0, 0.66, 0.875, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Requesting temp token from Twitter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L57_C0", "label": "resp, content = request()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.6264, 0.011, 0, 0.66, 0.9375, 339, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": "resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "label": "if", "type": "if", "loc": [59, 90], "level": 0, "parent": null, "vector": [4, 0, 0.8187, 0.3516, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if resp['status'] != '200':\n print('Invalid respond from Twitter requesting temp token: %s' % resp['status'])\nelse:\n request_token = dict(parse_qsl(content))\n\n print('')\n print('Please visit this Twitter page and retrieve the pincode to be used')\n print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L60_C2", "label": "print()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.6593, 0.011, 1, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Invalid respond from Twitter requesting temp token: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L62_C2", "label": "request_token = dict()", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.6813, 0.011, 1, 0.15, 0.0588, 279, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " request_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L64_C2", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7033, 0.011, 1, 0.15, 0.1176, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L65_C2", "label": "print()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7143, 0.011, 1, 0.15, 0.1765, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please visit this Twitter page and retrieve the pincode to be used')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7253, 0.011, 1, 0.15, 0.2353, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L67_C2", "label": "print()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7363, 0.011, 1, 0.15, 0.2941, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L68_C2", "label": "print()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7473, 0.011, 1, 0.15, 0.3529, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L69_C2", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.7582, 0.011, 1, 0.15, 0.4118, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L71_C2", "label": "pincode = raw_input()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.7802, 0.011, 1, 0.15, 0.4706, 437, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "pincode", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " pincode = raw_input('Pincode? ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L73_C2", "label": "token = Token()", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.8022, 0.011, 1, 0.15, 0.5294, 129, 3, 2, 0, 0, 92, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "Token", "annotation": ""}, "snippet": " token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L74_C2", "label": "set_verifier()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.8132, 0.011, 1, 0.15, 0.5882, 943, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_verifier", "arg_names": [], "import_names": [], "rhs_call_name": "set_verifier", "annotation": ""}, "snippet": " token.set_verifier(pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L76_C2", "label": "print()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.8352, 0.011, 1, 0.15, 0.6471, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L77_C2", "label": "print()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.8462, 0.011, 1, 0.15, 0.7059, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Generating and signing request for an access token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L78_C2", "label": "print()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [8, 1, 0.8571, 0.011, 1, 0.15, 0.7647, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L80_C2", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.8791, 0.011, 1, 0.15, 0.8235, 671, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " oauth_client = oauth.Client(oauth_consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L81_C2", "label": "resp, content = request()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.8901, 0.011, 1, 0.15, 0.8824, 339, 3, 3, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_callback=oob&oauth_verifier=%s' % pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L82_C2", "label": "access_token = dict()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [14, 1, 0.9011, 0.011, 1, 0.15, 0.9412, 797, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " access_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "label": "if", "type": "if", "loc": [84, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "vector": [4, 1, 0.956, 0.0769, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp['status'] != '200':\n print('The request for a Token did not succeed: %s' % resp['status'])\n print(access_token)\n else:\n print('Your Twitter Access Token key: %s' % access_token['oauth_token'])\n print(' Access Token secret: %s' % access_token['oauth_token_secret'])\n print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L85_C4", "label": "print()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "vector": [8, 2, 0.9341, 0.011, 2, 0.89, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The request for a Token did not succeed: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L86_C4", "label": "print()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "vector": [8, 2, 0.9451, 0.011, 2, 0.89, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(access_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L88_C4", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "vector": [8, 2, 0.967, 0.011, 2, 0.89, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Your Twitter Access Token key: %s' % access_token['oauth_token'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L89_C4", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "vector": [8, 2, 0.978, 0.011, 2, 0.89, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Access Token secret: %s' % access_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "vector": [8, 2, 0.989, 0.011, 2, 0.89, 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_43:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:ImportFrom_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:ImportFrom_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_43:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_43:Expr_L90_C4"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A class that defines the default URL Shortener. TinyURL is provided as the default and as an example. ''' import urllib # Change History # # 2010-05-16 # TinyURL example and the idea for this comes from a bug filed by # acolorado with patch provided by ghills. Class implementation # was done by bear. # # Issue 19 http://code.google.com/p/python-twitter/issues/detail?id=19 # class ShortenURL(object): '''Helper class to make URL Shortener calls if/when required''' def __init__(self, userid=None, password=None): '''Instantiate a new ShortenURL object Args: userid: userid for any required authorization call [optional] password: password for any required authorization call [optional] ''' self.userid = userid self.password = password def Shorten(self, longURL): '''Call TinyURL API and returned shortened URL result Args: longURL: URL string to shorten Returns: The shortened URL as a string Note: longURL is required and no checks are made to ensure completeness ''' result = None f = urllib.urlopen("http://tinyurl.com/api-create.php?url=%s" % longURL) try: result = f.read() finally: f.close() return result
ajibawa-2023/Python-Code-Large/train/row_44
16
71
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 20], "level": 0, "parent": null, "vector": [8, 0, 0.2606, 0.0563, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''A class that defines the default URL Shortener.\n\nTinyURL is provided as the default and as an example.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Import_L22_C0", "label": "urllib import urllib", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.3099, 0.0141, 0, 0.66, 0.5, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "label": "ShortenURL", "type": "class", "loc": [36, 71], "level": 0, "parent": null, "vector": [3, 0, 0.7535, 0.507, 0, 0.66, 1.0, 365, 0, 2, 0, 0, 186, 0, 3], "semantic": {"name": "ShortenURL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ShortenURL(object):\n '''Helper class to make URL Shortener calls if/when required'''\n def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "vector": [8, 1, 0.5211, 0.0141, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Helper class to make URL Shortener calls if/when required'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "label": "__init__", "type": "function", "loc": [38, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "vector": [2, 1, 0.6056, 0.1549, 1, 0.54, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "userid", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "vector": [8, 2, 0.6127, 0.0845, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L47_C8", "label": "self.userid =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "vector": [14, 2, 0.662, 0.0141, 2, 0.52, 0.5, 677, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.userid = userid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L48_C8", "label": "self.password =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "vector": [14, 2, 0.6761, 0.0141, 2, 0.52, 1.0, 902, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.password = password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "label": "Shorten", "type": "function", "loc": [50, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "vector": [2, 1, 0.8521, 0.3099, 1, 0.54, 1.0, 862, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "Shorten", "arg_names": ["self", "longURL"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Shorten(self,\n longURL):\n '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "vector": [8, 2, 0.8028, 0.1549, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:\n The shortened URL as a string\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L64_C8", "label": "result =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "vector": [14, 2, 0.9014, 0.0141, 2, 0.43, 0.25, 51, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L65_C8", "label": "f = urlopen()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "vector": [14, 2, 0.9155, 0.0141, 2, 0.43, 0.5, 899, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " f = urllib.urlopen(\"http://tinyurl.com/api-create.php?url=%s\" % longURL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8", "label": "try", "type": "try", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "vector": [7, 2, 0.9507, 0.0563, 2, 0.43, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result = f.read()\n finally:\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L67_C12", "label": "result = read()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8", "vector": [14, 3, 0.9437, 0.0141, 3, 0.8, 0.0, 51, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " result = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L69_C12", "label": "close()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8", "vector": [8, 3, 0.9718, 0.0141, 3, 0.8, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_44:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "vector": [13, 2, 1.0, 0.0141, 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 result"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_44:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_44:Return_L71_C8"}]
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twitter consumer key --consumer-secret : the twitter consumer secret --access-key : the twitter access token key --access-secret : the twitter access token secret --encoding : the character set encoding used in input strings, e.g. "utf-8". [optional] Documentation: If either of the command line flags are not present, the environment variables TWEETUSERNAME and TWEETPASSWORD will then be checked for your consumer_key or consumer_secret, respectively. If neither the command line flags nor the enviroment variables are present, the .tweetrc file, if it exists, can be used to set the default consumer_key and consumer_secret. The file should contain the following three lines, replacing *consumer_key* with your consumer key, and *consumer_secret* with your consumer secret: A skeletal .tweetrc file: [Tweet] consumer_key: *consumer_key* consumer_secret: *consumer_password* access_key: *access_key* access_secret: *access_password* ''' def PrintUsageAndExit(): print USAGE sys.exit(2) def GetConsumerKeyEnv(): return os.environ.get("TWEETUSERNAME", None) def GetConsumerSecretEnv(): return os.environ.get("TWEETPASSWORD", None) def GetAccessKeyEnv(): return os.environ.get("TWEETACCESSKEY", None) def GetAccessSecretEnv(): return os.environ.get("TWEETACCESSSECRET", None) class TweetRc(object): def __init__(self): self._config = None def GetConsumerKey(self): return self._GetOption('consumer_key') def GetConsumerSecret(self): return self._GetOption('consumer_secret') def GetAccessKey(self): return self._GetOption('access_key') def GetAccessSecret(self): return self._GetOption('access_secret') def _GetOption(self, option): try: return self._GetConfig().get('Tweet', option) except: return None def _GetConfig(self): if not self._config: self._config = ConfigParser.ConfigParser() self._config.read(os.path.expanduser('~/.tweetrc')) return self._config def main(): try: shortflags = 'h' longflags = ['help', 'consumer-key=', 'consumer-secret=', 'access-key=', 'access-secret=', 'encoding='] opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: PrintUsageAndExit() consumer_keyflag = None consumer_secretflag = None access_keyflag = None access_secretflag = None encoding = None for o, a in opts: if o in ("-h", "--help"): PrintUsageAndExit() if o in ("--consumer-key"): consumer_keyflag = a if o in ("--consumer-secret"): consumer_secretflag = a if o in ("--access-key"): access_keyflag = a if o in ("--access-secret"): access_secretflag = a if o in ("--encoding"): encoding = a message = ' '.join(args) if not message: PrintUsageAndExit() rc = TweetRc() consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey() consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret() access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey() access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret() if not consumer_key or not consumer_secret or not access_key or not access_secret: PrintUsageAndExit() api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_key, access_token_secret=access_secret, input_encoding=encoding) try: status = api.PostUpdate(message) except UnicodeDecodeError: print "Your message could not be encoded. Perhaps it contains non-ASCII characters? " print "Try explicitly specifying the encoding with the --encoding flag" sys.exit(2) print "%s just posted: %s" % (status.user.name, status.text) if __name__ == "__main__": main()
ajibawa-2023/Python-Code-Large/train/row_46
82
141
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0213, 0.0071, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Post a message to twitter'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L5_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.0355, 0.0071, 0, 0.66, 0.0667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'dewitt@google.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Import_L7_C0", "label": "ConfigParser import ConfigParser", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0071, 0, 0.66, 0.1333, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "ConfigParser", "arg_names": [], "import_names": ["ConfigParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ConfigParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Import_L8_C0", "label": "getopt import getopt", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0567, 0.0071, 0, 0.66, 0.2, 588, 0, 1, 0, 0, 588, 0, 0], "semantic": {"name": "getopt", "arg_names": [], "import_names": ["getopt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getopt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0071, 0, 0.66, 0.2667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Import_L10_C0", "label": "sys import sys", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0709, 0.0071, 0, 0.66, 0.3333, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Import_L11_C0", "label": "twitter import twitter", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0071, 0, 0.66, 0.4, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "twitter", "arg_names": [], "import_names": ["twitter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import twitter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L14_C0", "label": "USAGE =", "type": "assigned_variable", "loc": [14, 47], "level": 0, "parent": null, "vector": [14, 0, 0.2163, 0.2411, 0, 0.66, 0.4667, 952, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "USAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USAGE = '''Usage: tweet [options] message\n\n This script posts a message to Twitter.\n\n Options:\n\n -h --help : print this help\n --consumer-key : the twitter consumer key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L49_C0", "label": "PrintUsageAndExit", "type": "function", "loc": [49, 51], "level": 0, "parent": null, "vector": [2, 0, 0.3546, 0.0213, 0, 0.66, 0.5333, 314, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PrintUsageAndExit():\n print(USAGE)\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L50_C2", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L49_C0", "vector": [8, 1, 0.3546, 0.0071, 1, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(USAGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L51_C2", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L49_C0", "vector": [8, 1, 0.3617, 0.0071, 1, 0.97, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L53_C0", "label": "GetConsumerKeyEnv", "type": "function", "loc": [53, 54], "level": 0, "parent": null, "vector": [2, 0, 0.3794, 0.0142, 0, 0.66, 0.6, 551, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerKeyEnv():\n return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L54_C2", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L53_C0", "vector": [13, 1, 0.383, 0.0071, 1, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L56_C0", "label": "GetConsumerSecretEnv", "type": "function", "loc": [56, 57], "level": 0, "parent": null, "vector": [2, 0, 0.4007, 0.0142, 0, 0.66, 0.6667, 650, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerSecretEnv():\n return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L56_C0", "vector": [13, 1, 0.4043, 0.0071, 1, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L59_C0", "label": "GetAccessKeyEnv", "type": "function", "loc": [59, 60], "level": 0, "parent": null, "vector": [2, 0, 0.422, 0.0142, 0, 0.66, 0.7333, 932, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessKeyEnv():\n return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L59_C0", "vector": [13, 1, 0.4255, 0.0071, 1, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L62_C0", "label": "GetAccessSecretEnv", "type": "function", "loc": [62, 63], "level": 0, "parent": null, "vector": [2, 0, 0.4433, 0.0142, 0, 0.66, 0.8, 325, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessSecretEnv():\n return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L62_C0", "vector": [13, 1, 0.4468, 0.0071, 1, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "label": "TweetRc", "type": "class", "loc": [65, 91], "level": 0, "parent": null, "vector": [3, 0, 0.5532, 0.1915, 0, 0.66, 0.8667, 61, 0, 7, 0, 0, 186, 0, 9], "semantic": {"name": "TweetRc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TweetRc(object):\n def __init__(self):\n self._config = None\n\n def GetConsumerKey(self):\n return self._GetOption('consumer_key')\n\n def GetConsumerSecret(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L66_C2", "label": "__init__", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.4716, 0.0142, 1, 0.45, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L67_C4", "label": "self._config =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L66_C2", "vector": [14, 2, 0.4752, 0.0071, 2, 0.75, 0.0, 311, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L69_C2", "label": "GetConsumerKey", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.4929, 0.0142, 1, 0.45, 0.1667, 101, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerKey(self):\n return self._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L69_C2", "vector": [13, 2, 0.4965, 0.0071, 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._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L72_C2", "label": "GetConsumerSecret", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.5142, 0.0142, 1, 0.45, 0.3333, 743, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerSecret(self):\n return self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L72_C2", "vector": [13, 2, 0.5177, 0.0071, 2, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L75_C2", "label": "GetAccessKey", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.5355, 0.0142, 1, 0.45, 0.5, 392, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessKey(self):\n return self._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L75_C2", "vector": [13, 2, 0.539, 0.0071, 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._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L78_C2", "label": "GetAccessSecret", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.5567, 0.0142, 1, 0.45, 0.6667, 686, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessSecret(self):\n return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L79_C4", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L78_C2", "vector": [13, 2, 0.5603, 0.0071, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L81_C2", "label": "_GetOption", "type": "function", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.5887, 0.0355, 1, 0.45, 0.8333, 808, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_GetOption", "arg_names": ["self", "option"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetOption(self, option):\n try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4", "label": "try", "type": "try", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L81_C2", "vector": [7, 2, 0.5922, 0.0284, 2, 0.59, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L83_C6", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4", "vector": [13, 3, 0.5887, 0.0071, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetConfig().get('Tweet', option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L85_C6", "label": "return", "type": "return", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4", "vector": [13, 3, 0.6028, 0.0071, 3, 0.11, 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_46:FunctionDef_L87_C2", "label": "_GetConfig", "type": "function", "loc": [87, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "vector": [2, 1, 0.6312, 0.0355, 1, 0.45, 1.0, 33, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_GetConfig", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetConfig(self):\n if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))\n return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4", "label": "if", "type": "if", "loc": [88, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L87_C2", "vector": [4, 2, 0.6312, 0.0213, 2, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L89_C6", "label": "self._config = ConfigParser()", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4", "vector": [14, 3, 0.6312, 0.0071, 3, 0.77, 0.0, 311, 3, 0, 0, 0, 272, 10, 1], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "ConfigParser", "annotation": ""}, "snippet": " self._config = ConfigParser.ConfigParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L90_C6", "label": "read()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4", "vector": [8, 3, 0.6383, 0.0071, 3, 0.77, 1.0, 453, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L87_C2", "vector": [13, 2, 0.6454, 0.0071, 2, 0.19, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "label": "main", "type": "function", "loc": [93, 138], "level": 0, "parent": null, "vector": [2, 0, 0.8191, 0.3262, 0, 0.66, 0.9333, 624, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "label": "try", "type": "try", "loc": [94, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [7, 1, 0.6879, 0.0496, 1, 0.57, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L95_C4", "label": "shortflags =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "vector": [14, 2, 0.6738, 0.0071, 2, 0.44, 0.0, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "shortflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shortflags = 'h'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L96_C4", "label": "longflags =", "type": "assigned_variable", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "vector": [14, 2, 0.6844, 0.0142, 2, 0.44, 0.5, 745, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "longflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L98_C4", "label": "opts, args = gnu_getopt()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "vector": [14, 2, 0.695, 0.0071, 2, 0.44, 1.0, 616, 3, 3, 0, 0, 712, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "gnu_getopt", "annotation": ""}, "snippet": " opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L100_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "vector": [8, 2, 0.7092, 0.0071, 2, 0.44, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L101_C2", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.7163, 0.0071, 1, 0.57, 0.0588, 74, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L102_C2", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.7234, 0.0071, 1, 0.57, 0.1176, 178, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L103_C2", "label": "access_keyflag =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.7305, 0.0071, 1, 0.57, 0.1765, 450, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L104_C2", "label": "access_secretflag =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.7376, 0.0071, 1, 0.57, 0.2353, 83, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L105_C2", "label": "encoding =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.7447, 0.0071, 1, 0.57, 0.2941, 325, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "label": "for o, a", "type": "for", "loc": [106, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [6, 1, 0.7943, 0.0922, 1, 0.57, 0.3529, 736, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for o, a in opts:\n if o in (\"-h\", \"--help\"):\n PrintUsageAndExit()\n if o in (\"--consumer-key\"):\n consumer_keyflag = a\n if o in (\"--consumer-secret\"):\n consumer_secretflag = a\n if o in (\"--access-key\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L107_C4", "label": "if", "type": "if", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.7624, 0.0142, 2, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"-h\", \"--help\"):\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L108_C6", "label": "PrintUsageAndExit()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L107_C4", "vector": [8, 3, 0.766, 0.0071, 3, 0.86, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L109_C4", "label": "if", "type": "if", "loc": [109, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.7766, 0.0142, 2, 0.41, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-key\"):\n consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L110_C6", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L109_C4", "vector": [14, 3, 0.7801, 0.0071, 3, 0.14, 0.0, 74, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L111_C4", "label": "if", "type": "if", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.7908, 0.0142, 2, 0.41, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-secret\"):\n consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L112_C6", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L111_C4", "vector": [14, 3, 0.7943, 0.0071, 3, 0.05, 0.0, 178, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.805, 0.0142, 2, 0.41, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-key\"):\n access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L114_C6", "label": "access_keyflag =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L113_C4", "vector": [14, 3, 0.8085, 0.0071, 3, 0.62, 0.0, 450, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.8191, 0.0142, 2, 0.41, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-secret\"):\n access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L116_C6", "label": "access_secretflag =", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L115_C4", "vector": [14, 3, 0.8227, 0.0071, 3, 0.69, 0.0, 83, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L117_C4", "label": "if", "type": "if", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "vector": [4, 2, 0.8333, 0.0142, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--encoding\"):\n encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L118_C6", "label": "encoding =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L117_C4", "vector": [14, 3, 0.8369, 0.0071, 3, 0.69, 0.0, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L119_C2", "label": "message = join()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.844, 0.0071, 1, 0.57, 0.4118, 635, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " message = ' '.join(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L120_C2", "label": "if", "type": "if", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [4, 1, 0.8546, 0.0142, 1, 0.57, 0.4706, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not message:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L121_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L120_C2", "vector": [8, 2, 0.8582, 0.0071, 2, 0.14, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L122_C2", "label": "rc = TweetRc()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.8652, 0.0071, 1, 0.57, 0.5294, 401, 3, 0, 0, 0, 61, 10, 1], "semantic": {"name": "rc", "arg_names": [], "import_names": [], "rhs_call_name": "TweetRc", "annotation": ""}, "snippet": " rc = TweetRc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L123_C2", "label": "consumer_key =", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.8723, 0.0071, 1, 0.57, 0.5882, 353, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L124_C2", "label": "consumer_secret =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.8794, 0.0071, 1, 0.57, 0.6471, 734, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L125_C2", "label": "access_key =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.8865, 0.0071, 1, 0.57, 0.7059, 200, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L126_C2", "label": "access_secret =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.8936, 0.0071, 1, 0.57, 0.7647, 171, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L127_C2", "label": "if", "type": "if", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [4, 1, 0.9043, 0.0142, 1, 0.57, 0.8235, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer_key or not consumer_secret or not access_key or not access_secret:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L128_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L127_C2", "vector": [8, 2, 0.9078, 0.0071, 2, 0.31, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L129_C2", "label": "api = Api()", "type": "assigned_variable", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [14, 1, 0.922, 0.0213, 1, 0.57, 0.8824, 976, 3, 5, 0, 0, 192, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "Api", "annotation": ""}, "snippet": " api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret,\n access_token_key=access_key, access_token_secret=access_secret,\n input_encoding=encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "label": "try", "type": "try", "loc": [132, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [7, 1, 0.9539, 0.0426, 1, 0.57, 0.9412, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n status = api.PostUpdate(message)\n except UnicodeDecodeError:\n print(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")\n print(\"Try explicitly specifying the encoding with the --encoding flag\")\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L133_C4", "label": "status = PostUpdate()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "vector": [14, 2, 0.9433, 0.0071, 2, 0.65, 0.0, 699, 3, 1, 0, 0, 880, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "PostUpdate", "annotation": ""}, "snippet": " status = api.PostUpdate(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L135_C4", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "vector": [8, 2, 0.9574, 0.0071, 2, 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(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L136_C4", "label": "print()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "vector": [8, 2, 0.9645, 0.0071, 2, 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(\"Try explicitly specifying the encoding with the --encoding flag\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L137_C4", "label": "exit()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "vector": [8, 2, 0.9716, 0.0071, 2, 0.65, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L138_C2", "label": "print()", "type": "expression", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "vector": [8, 1, 0.9787, 0.0071, 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(\"%s just posted: %s\" % (status.user.name, status.text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:If_L140_C0", "label": "if", "type": "if", "loc": [140, 141], "level": 0, "parent": null, "vector": [4, 0, 0.9965, 0.0142, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L141_C2", "label": "main()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_46:If_L140_C0", "vector": [8, 1, 1.0, 0.0071, 1, 0.43, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L89_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L90_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L110_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L112_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L116_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L118_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:If_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L138_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_46:If_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_46:Expr_L141_C2"}]
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match encoding = context.encoding strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration if nextchar == '"': return parse_string(string, idx + 1, encoding, strict) elif nextchar == '{': return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration return _scan_once make_scanner = c_make_scanner or py_make_scanner
ajibawa-2023/Python-Code-Large/train/row_47
48
65
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_47:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"JSON token scanner\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.0846, 0.0615, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:ImportFrom_L5_C4", "label": "from simplejson._speedups import c_make_scanner", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L4_C0", "vector": [1, 1, 0.0769, 0.0154, 1, 0.08, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_scanner"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_scanner as c_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L7_C4", "label": "c_make_scanner =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L4_C0", "vector": [14, 1, 0.1077, 0.0154, 1, 0.08, 0.0, 400, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L9_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1385, 0.0154, 0, 0.66, 0.5, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['make_scanner']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L11_C0", "label": "NUMBER_RE = compile()", "type": "assigned_variable", "loc": [11, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1846, 0.0462, 0, 0.66, 0.6667, 566, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "NUMBER_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "NUMBER_RE = re.compile(\n r'(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?',\n (re.VERBOSE | re.MULTILINE | re.DOTALL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "label": "py_make_scanner", "type": "function", "loc": [15, 63], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.7538, 0, 0.66, 0.8333, 796, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "py_make_scanner", "arg_names": ["context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_make_scanner(context):\n parse_object = context.parse_object\n parse_array = context.parse_array\n parse_string = context.parse_string\n match_number = NUMBER_RE.match\n encoding = context.encoding\n strict = context.strict\n parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L16_C4", "label": "parse_object =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.05, 0.0, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_object = context.parse_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L17_C4", "label": "parse_array =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.05, 0.0909, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_array = context.parse_array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L18_C4", "label": "parse_string =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.05, 0.1818, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_string = context.parse_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L19_C4", "label": "match_number =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.2923, 0.0154, 1, 0.05, 0.2727, 264, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_number = NUMBER_RE.match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L20_C4", "label": "encoding =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3077, 0.0154, 1, 0.05, 0.3636, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = context.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L21_C4", "label": "strict =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3231, 0.0154, 1, 0.05, 0.4545, 697, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = context.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L22_C4", "label": "parse_float =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3385, 0.0154, 1, 0.05, 0.5455, 475, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_float", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L23_C4", "label": "parse_int =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3538, 0.0154, 1, 0.05, 0.6364, 31, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_int", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_int = context.parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L24_C4", "label": "parse_constant =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3692, 0.0154, 1, 0.05, 0.7273, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_constant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_constant = context.parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L25_C4", "label": "object_hook =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [14, 1, 0.3846, 0.0154, 1, 0.05, 0.8182, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_hook = context.object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "label": "_scan_once", "type": "function", "loc": [27, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [2, 1, 0.6769, 0.5385, 1, 0.05, 0.9091, 221, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_scan_once", "arg_names": ["string", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _scan_once(string, idx):\n try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration\n\n if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "vector": [7, 2, 0.4538, 0.0615, 2, 0.34, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L29_C12", "label": "nextchar =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L28_C8", "vector": [14, 3, 0.4462, 0.0154, 3, 0.3, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nextchar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nextchar = string[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8", "label": "if", "type": "if", "loc": [33, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "vector": [4, 2, 0.5923, 0.1846, 2, 0.34, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)\n elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L34_C12", "label": "return", "type": "return", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8", "vector": [13, 3, 0.5231, 0.0154, 3, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8", "label": "if", "type": "if", "loc": [35, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8", "vector": [4, 3, 0.6077, 0.1538, 3, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L36_C12", "label": "return", "type": "return", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8", "vector": [13, 4, 0.5538, 0.0154, 4, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8", "label": "if", "type": "if", "loc": [37, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8", "vector": [4, 4, 0.6231, 0.1231, 4, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L38_C12", "label": "return", "type": "return", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8", "vector": [13, 5, 0.5846, 0.0154, 5, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_array((string, idx + 1), _scan_once)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8", "vector": [4, 5, 0.6385, 0.0923, 5, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8", "vector": [13, 6, 0.6154, 0.0154, 6, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8", "label": "if", "type": "if", "loc": [41, 44], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8", "vector": [4, 6, 0.6538, 0.0615, 6, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L42_C12", "label": "return", "type": "return", "loc": [42, 42], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8", "vector": [13, 7, 0.6462, 0.0154, 7, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L43_C8", "label": "if", "type": "if", "loc": [43, 44], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8", "vector": [4, 7, 0.6692, 0.0308, 7, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L44_C12", "label": "return", "type": "return", "loc": [44, 44], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L43_C8", "vector": [13, 8, 0.6769, 0.0154, 8, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L46_C8", "label": "m = match_number()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "vector": [14, 2, 0.7077, 0.0154, 2, 0.34, 0.6667, 711, 3, 2, 0, 0, 264, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match_number", "annotation": ""}, "snippet": " m = match_number(string, idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "label": "if", "type": "if", "loc": [47, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "vector": [4, 2, 0.8308, 0.2308, 2, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m is not None:\n integer, frac, exp = m.groups()\n if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)\n return res, m.end()\n elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L48_C12", "label": "integer, frac, exp = groups()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "vector": [14, 3, 0.7385, 0.0154, 3, 0.35, 0.0, 563, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "integer, frac, exp", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " integer, frac, exp = m.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12", "label": "if", "type": "if", "loc": [49, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "vector": [4, 3, 0.7769, 0.0615, 3, 0.35, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L50_C16", "label": "res = parse_float()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12", "vector": [14, 4, 0.7692, 0.0154, 4, 0.72, 0.0, 413, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_float", "annotation": ""}, "snippet": " res = parse_float(integer + (frac or '') + (exp or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L52_C16", "label": "res = parse_int()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12", "vector": [14, 4, 0.8, 0.0154, 4, 0.72, 1.0, 413, 3, 1, 0, 0, 31, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_int", "annotation": ""}, "snippet": " res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "vector": [13, 3, 0.8154, 0.0154, 3, 0.35, 0.6667, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res, m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "vector": [4, 3, 0.8846, 0.1231, 3, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\n return parse_constant('NaN'), idx + 3\n elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8", "vector": [13, 4, 0.8462, 0.0154, 4, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('NaN'), idx + 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8", "label": "if", "type": "if", "loc": [56, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8", "vector": [4, 4, 0.9, 0.0923, 4, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8", "vector": [13, 5, 0.8769, 0.0154, 5, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('Infinity'), idx + 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8", "vector": [4, 5, 0.9154, 0.0615, 5, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:If_L58_C8", "vector": [13, 6, 0.9077, 0.0154, 6, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('-Infinity'), idx + 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "vector": [13, 1, 0.9692, 0.0154, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _scan_once"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L65_C0", "label": "make_scanner =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0154, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "make_scanner = c_make_scanner or py_make_scanner"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_47:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_47:Return_L63_C4"}]
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # Assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') FLOAT_REPR = repr def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii class JSONEncoder(object): """Extensible JSON <http://json.org> encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys: _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals False=False, True=True, ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = dct.items() items.sort(key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif _skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode
ajibawa-2023/Python-Code-Large/train/row_49
230
434
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0046, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Implementation of JSONEncoder\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0023, 0, 0.66, 0.0667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L5_C0", "label": "try", "type": "try", "loc": [5, 8], "level": 0, "parent": null, "vector": [7, 0, 0.015, 0.0092, 0, 0.66, 0.1333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:ImportFrom_L6_C4", "label": "from simplejson._speedups import c_encode_basestring_ascii", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L5_C0", "vector": [1, 1, 0.0138, 0.0023, 1, 0.27, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_encode_basestring_ascii"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L8_C4", "label": "c_encode_basestring_ascii =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L5_C0", "vector": [14, 1, 0.0184, 0.0023, 1, 0.27, 0.0, 485, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L9_C0", "label": "try", "type": "try", "loc": [9, 12], "level": 0, "parent": null, "vector": [7, 0, 0.0242, 0.0092, 0, 0.66, 0.2, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:ImportFrom_L10_C4", "label": "from simplejson._speedups import c_make_encoder", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L9_C0", "vector": [1, 1, 0.023, 0.0023, 1, 0.51, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L12_C4", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L9_C0", "vector": [14, 1, 0.0276, 0.0023, 1, 0.51, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L14_C0", "label": "ESCAPE = compile()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0323, 0.0023, 0, 0.66, 0.2667, 562, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L15_C0", "label": "ESCAPE_ASCII = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0346, 0.0023, 0, 0.66, 0.3333, 214, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE_ASCII", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L16_C0", "label": "HAS_UTF8 = compile()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0369, 0.0023, 0, 0.66, 0.4, 954, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "HAS_UTF8", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "HAS_UTF8 = re.compile(r'[\\x80-\\xff]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L17_C0", "label": "ESCAPE_DCT =", "type": "assigned_variable", "loc": [17, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0484, 0.0207, 0, 0.66, 0.4667, 404, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ESCAPE_DCT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_DCT = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L26_C0", "label": "for i", "type": "for", "loc": [26, 27], "level": 0, "parent": null, "vector": [6, 0, 0.0611, 0.0046, 0, 0.66, 0.5333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L27_C4", "label": "setdefault()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L26_C0", "vector": [8, 1, 0.0622, 0.0023, 1, 0.99, 0.0, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L30_C0", "label": "INFINITY = float()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.0691, 0.0023, 0, 0.66, 0.6, 681, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "INFINITY", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "INFINITY = float('1e66666')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L31_C0", "label": "FLOAT_REPR =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0023, 0, 0.66, 0.6667, 39, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLOAT_REPR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLOAT_REPR = repr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "label": "encode_basestring", "type": "function", "loc": [33, 39], "level": 0, "parent": null, "vector": [2, 0, 0.0829, 0.0161, 0, 0.66, 0.7333, 207, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "encode_basestring", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_basestring(s):\n \"\"\"Return a JSON representation of a Python string\n\n \"\"\"\n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "vector": [8, 1, 0.0806, 0.0069, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L37_C4", "label": "replace", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "vector": [2, 1, 0.0864, 0.0046, 1, 0.46, 0.5, 293, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L37_C4", "vector": [13, 2, 0.0876, 0.0023, 2, 0.72, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "vector": [13, 1, 0.0899, 0.0023, 1, 0.46, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "label": "py_encode_basestring_ascii", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.1198, 0.0484, 0, 0.66, 0.8, 438, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "py_encode_basestring_ascii", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_encode_basestring_ascii(s):\n \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "vector": [8, 1, 0.1014, 0.0069, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L46_C4", "label": "if", "type": "if", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "vector": [4, 1, 0.1071, 0.0046, 1, 0.73, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L47_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L46_C4", "vector": [14, 2, 0.1083, 0.0023, 2, 0.95, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4", "label": "replace", "type": "function", "loc": [48, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "vector": [2, 1, 0.1256, 0.0323, 1, 0.73, 0.6667, 293, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L49_C8", "label": "s = group()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4", "vector": [14, 2, 0.1129, 0.0023, 2, 0.4, 0.0, 553, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "label": "try", "type": "try", "loc": [50, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4", "vector": [7, 2, 0.1279, 0.0276, 2, 0.4, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "vector": [13, 3, 0.1175, 0.0023, 3, 0.95, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[s]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L53_C12", "label": "n = ord()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "vector": [14, 3, 0.1221, 0.0023, 3, 0.95, 0.0, 773, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " n = ord(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "vector": [4, 3, 0.1325, 0.0184, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair\n n -= 0x10000\n s1 = 0xd800 | ((n >> 10) & 0x3ff)\n s2 = 0xdc00 | (n & 0x3ff)\n return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L55_C16", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "vector": [13, 4, 0.1267, 0.0023, 4, 0.65, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L59_C16", "label": "s1 =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "vector": [14, 4, 0.1359, 0.0023, 4, 0.65, 0.3333, 745, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s1 = 0xd800 | ((n >> 10) & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L60_C16", "label": "s2 =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "vector": [14, 4, 0.1382, 0.0023, 4, 0.65, 0.6667, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L61_C16", "label": "return", "type": "return", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "vector": [13, 4, 0.1406, 0.0023, 4, 0.65, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "vector": [13, 1, 0.1429, 0.0023, 1, 0.73, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + str(ESCAPE_ASCII.sub(replace, s)) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L65_C0", "label": "encode_basestring_ascii =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.1498, 0.0023, 0, 0.66, 0.8667, 105, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "label": "JSONEncoder", "type": "class", "loc": [67, 256], "level": 0, "parent": null, "vector": [3, 0, 0.3721, 0.4378, 0, 0.66, 0.9333, 228, 0, 6, 0, 0, 186, 0, 18], "semantic": {"name": "JSONEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONEncoder(object):\n \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [8, 1, 0.1878, 0.0645, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+\n | dict | object |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L96_C4", "label": "item_separator =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [14, 1, 0.2212, 0.0023, 1, 0.69, 0.1667, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = ', '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L97_C4", "label": "key_separator =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [14, 1, 0.2235, 0.0023, 1, 0.69, 0.3333, 294, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_separator = ': '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [2, 1, 0.2903, 0.1313, 1, 0.69, 0.5, 555, 0, 10, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "sort_keys", "indent", "separators", "encoding", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, skipkeys=False, ensure_ascii=True,\n check_circular=True, allow_nan=True, sort_keys=False,\n indent=None, separators=None, encoding='utf-8', default=None):\n \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [8, 2, 0.28, 0.0968, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped.\n\n If ensure_ascii is True, the output is guaranteed to be str\n objects with all incoming unicode characters escaped. If"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L144_C8", "label": "self.skipkeys =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3318, 0.0023, 2, 0.53, 0.1111, 853, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.skipkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.skipkeys = skipkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L145_C8", "label": "self.ensure_ascii =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3341, 0.0023, 2, 0.53, 0.2222, 255, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ensure_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ensure_ascii = ensure_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L146_C8", "label": "self.check_circular =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3364, 0.0023, 2, 0.53, 0.3333, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.check_circular", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_circular = check_circular"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L147_C8", "label": "self.allow_nan =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3387, 0.0023, 2, 0.53, 0.4444, 507, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_nan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_nan = allow_nan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L148_C8", "label": "self.sort_keys =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.341, 0.0023, 2, 0.53, 0.5556, 911, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sort_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sort_keys = sort_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L149_C8", "label": "self.indent =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3433, 0.0023, 2, 0.53, 0.6667, 771, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.indent = indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L150_C8", "label": "if", "type": "if", "loc": [150, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [4, 2, 0.3468, 0.0046, 2, 0.53, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if separators is not None:\n self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L151_C12", "label": "assign", "type": "assigned_variable", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L150_C8", "vector": [14, 3, 0.3479, 0.0023, 3, 0.24, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [4, 2, 0.3514, 0.0046, 2, 0.53, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default is not None:\n self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L153_C12", "label": "self.default =", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L152_C8", "vector": [14, 3, 0.3525, 0.0023, 3, 0.55, 0.0, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L154_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "vector": [14, 2, 0.3548, 0.0023, 2, 0.53, 1.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L156_C4", "label": "default", "type": "function", "loc": [156, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [2, 1, 0.3802, 0.0438, 1, 0.69, 0.6667, 977, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "default", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, o):\n \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L156_C4", "vector": [8, 2, 0.3802, 0.0392, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n\n def default(self, o):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "label": "encode", "type": "function", "loc": [176, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [2, 1, 0.4332, 0.0576, 1, 0.69, 0.8333, 623, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "encode", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, o):\n \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\"\n # This is for extremely simple cases and benchmarks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L177_C8", "label": "expression", "type": "expression", "loc": [177, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "vector": [8, 2, 0.4136, 0.0138, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8", "label": "if", "type": "if", "loc": [184, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "vector": [4, 2, 0.4343, 0.023, 2, 0.14, 0.25, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)\n if self.ensure_ascii:\n return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12", "label": "if", "type": "if", "loc": [185, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8", "vector": [4, 3, 0.4309, 0.0115, 3, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L186_C16", "label": "_encoding =", "type": "assigned_variable", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12", "vector": [14, 4, 0.4286, 0.0023, 4, 0.83, 0.0, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoding = self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L187_C16", "label": "if", "type": "if", "loc": [187, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12", "vector": [4, 4, 0.4332, 0.0069, 4, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L189_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L187_C16", "vector": [14, 5, 0.4355, 0.0023, 5, 0.68, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12", "label": "if", "type": "if", "loc": [190, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8", "vector": [4, 3, 0.4412, 0.0092, 3, 0.25, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else:\n return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L191_C16", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12", "vector": [13, 4, 0.4401, 0.0023, 4, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L193_C16", "label": "return", "type": "return", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12", "vector": [13, 4, 0.4447, 0.0023, 4, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L197_C8", "label": "chunks = iterencode()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "vector": [14, 2, 0.4539, 0.0023, 2, 0.14, 0.5, 284, 3, 2, 0, 0, 315, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " chunks = self.iterencode(o, _one_shot=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L198_C8", "label": "if", "type": "if", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "vector": [4, 2, 0.4574, 0.0046, 2, 0.14, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(chunks, (list, tuple)):\n chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L199_C12", "label": "chunks = list()", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L198_C8", "vector": [14, 3, 0.4585, 0.0023, 3, 0.23, 0.0, 284, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "vector": [13, 2, 0.4608, 0.0023, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "label": "iterencode", "type": "function", "loc": [202, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "vector": [2, 1, 0.5276, 0.1267, 1, 0.69, 1.0, 315, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "iterencode", "arg_names": ["self", "o", "_one_shot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterencode(self, o, _one_shot=False):\n \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L203_C8", "label": "expression", "type": "expression", "loc": [203, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [8, 2, 0.477, 0.0207, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8", "label": "if", "type": "if", "loc": [212, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [4, 2, 0.4919, 0.0092, 2, 0.25, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_circular:\n markers = {}\n else:\n markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L213_C12", "label": "markers =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8", "vector": [14, 3, 0.4908, 0.0023, 3, 0.97, 0.0, 586, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L215_C12", "label": "markers =", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8", "vector": [14, 3, 0.4954, 0.0023, 3, 0.97, 1.0, 586, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8", "label": "if", "type": "if", "loc": [216, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [4, 2, 0.5012, 0.0092, 2, 0.25, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n _encoder = encode_basestring_ascii\n else:\n _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L217_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8", "vector": [14, 3, 0.5, 0.0023, 3, 0.19, 0.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L219_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8", "vector": [14, 3, 0.5046, 0.0023, 3, 0.19, 1.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L220_C8", "label": "if", "type": "if", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [4, 2, 0.5115, 0.0115, 2, 0.25, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.encoding != 'utf-8':\n def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12", "label": "_encoder", "type": "function", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L220_C8", "vector": [2, 3, 0.5127, 0.0092, 3, 0.8, 0.0, 153, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_encoder", "arg_names": ["o", "_orig_encoder", "_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L222_C16", "label": "if", "type": "if", "loc": [222, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12", "vector": [4, 4, 0.5127, 0.0046, 4, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L223_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [223, 223], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L222_C16", "vector": [14, 5, 0.5138, 0.0023, 5, 0.51, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L224_C16", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12", "vector": [13, 4, 0.5161, 0.0023, 4, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "label": "floatstr", "type": "function", "loc": [226, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [2, 2, 0.5403, 0.0415, 2, 0.25, 0.6667, 122, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "floatstr", "arg_names": ["o", "allow_nan", "_repr", "_inf", "_neginf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):\n # Check for specials. Note that this type of test is processor- and/or\n # platform-specific, so do tests which don't depend on the internals.\n\n if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12", "label": "if", "type": "if", "loc": [230, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "vector": [4, 3, 0.538, 0.0184, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L231_C16", "label": "text =", "type": "assigned_variable", "loc": [231, 231], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12", "vector": [14, 4, 0.5323, 0.0023, 4, 0.75, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12", "label": "if", "type": "if", "loc": [232, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12", "vector": [4, 4, 0.5403, 0.0138, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L233_C16", "label": "text =", "type": "assigned_variable", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12", "vector": [14, 5, 0.5369, 0.0023, 5, 0.73, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12", "vector": [4, 5, 0.5426, 0.0092, 5, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L235_C16", "label": "text =", "type": "assigned_variable", "loc": [235, 235], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12", "vector": [14, 6, 0.5415, 0.0023, 6, 0.96, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = '-Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L237_C16", "label": "return", "type": "return", "loc": [237, 237], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12", "vector": [13, 6, 0.5461, 0.0023, 6, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L239_C12", "label": "if", "type": "if", "loc": [239, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "vector": [4, 3, 0.553, 0.0069, 3, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_nan:\n raise ValueError(\"Out of range float values are not JSON compliant: %r\"\n % (o,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L243_C12", "label": "return", "type": "return", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "vector": [13, 3, 0.5599, 0.0023, 3, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8", "label": "if", "type": "if", "loc": [246, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [4, 2, 0.5772, 0.023, 2, 0.25, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:\n _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)\n else:\n _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L247_C12", "label": "_iterencode = c_make_encoder()", "type": "assigned_variable", "loc": [247, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8", "vector": [14, 3, 0.5726, 0.0092, 3, 0.06, 0.0, 136, 3, 9, 0, 0, 30, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "c_make_encoder", "annotation": ""}, "snippet": " _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L252_C12", "label": "_iterencode = _make_iterencode()", "type": "assigned_variable", "loc": [252, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8", "vector": [14, 3, 0.5841, 0.0092, 3, 0.06, 1.0, 136, 3, 10, 0, 0, 845, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "_make_iterencode", "annotation": ""}, "snippet": " _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, _one_shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "vector": [13, 2, 0.5899, 0.0023, 2, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode(o, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "label": "_make_iterencode", "type": "function", "loc": [258, 434], "level": 0, "parent": null, "vector": [2, 0, 0.7972, 0.4078, 0, 0.66, 1.0, 845, 0, 21, 1, 0, 0, 0, 50], "semantic": {"name": "_make_iterencode", "arg_names": ["markers", "_default", "_encoder", "_indent", "_floatstr", "_key_separator", "_item_separator", "_sort_keys", "_skipkeys", "_one_shot", "ValueError", "basestring", "dict", "float", "id", "int", "isinstance", "list", "long", "str", "tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\n ## HACK: hand-optimized bytecode; turn globals into locals\n ValueError=ValueError,\n basestring=basestring,\n dict=dict,\n float=float,\n id=id,\n int=int,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "label": "_iterencode_list", "type": "function", "loc": [273, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "vector": [2, 1, 0.6878, 0.1198, 1, 0.76, 0.0, 1, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "_iterencode_list", "arg_names": ["lst", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_list(lst, _current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8", "label": "if", "type": "if", "loc": [274, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [4, 2, 0.6336, 0.0069, 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 lst:\n yield '[]'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L275_C12", "label": "expression", "type": "expression", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8", "vector": [8, 3, 0.6336, 0.0023, 3, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '[]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L276_C12", "label": "return", "type": "return", "loc": [276, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8", "vector": [13, 3, 0.6359, 0.0023, 3, 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_49:If_L277_C8", "label": "if", "type": "if", "loc": [277, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [4, 2, 0.6429, 0.0115, 2, 0.1, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L278_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "vector": [14, 3, 0.6406, 0.0023, 3, 0.56, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(lst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L279_C12", "label": "if", "type": "if", "loc": [279, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "vector": [4, 3, 0.644, 0.0046, 3, 0.56, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L281_C12", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "vector": [14, 3, 0.6475, 0.0023, 3, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L282_C8", "label": "buf =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [14, 2, 0.6498, 0.0023, 2, 0.1, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = '['"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "label": "if", "type": "if", "loc": [283, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [4, 2, 0.6601, 0.0184, 2, 0.1, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n separator = _item_separator + newline_indent\n buf += newline_indent\n else:\n newline_indent = None\n separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L285_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "vector": [14, 3, 0.6567, 0.0023, 3, 0.24, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L286_C12", "label": "separator =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "vector": [14, 3, 0.659, 0.0023, 3, 0.24, 0.3333, 539, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L289_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "vector": [14, 3, 0.6659, 0.0023, 3, 0.24, 0.6667, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L290_C12", "label": "separator =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "vector": [14, 3, 0.6682, 0.0023, 3, 0.24, 1.0, 539, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L291_C8", "label": "first =", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [14, 2, 0.6705, 0.0023, 2, 0.1, 0.5, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8", "label": "for value", "type": "for", "loc": [292, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [6, 2, 0.7028, 0.0622, 2, 0.1, 0.625, 441, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value in lst:\n if first:\n first = False\n else:\n buf = separator\n if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12", "label": "if", "type": "if", "loc": [293, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8", "vector": [4, 3, 0.6786, 0.0092, 3, 0.59, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L294_C16", "label": "first =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12", "vector": [14, 4, 0.6774, 0.0023, 4, 0.75, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L296_C16", "label": "buf =", "type": "assigned_variable", "loc": [296, 296], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12", "vector": [14, 4, 0.682, 0.0023, 4, 0.75, 1.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12", "label": "if", "type": "if", "loc": [297, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8", "vector": [4, 3, 0.7085, 0.0507, 3, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L298_C16", "label": "expression", "type": "expression", "loc": [298, 298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12", "vector": [8, 4, 0.6866, 0.0023, 4, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12", "label": "if", "type": "if", "loc": [299, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12", "vector": [4, 4, 0.7108, 0.0461, 4, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L300_C16", "label": "expression", "type": "expression", "loc": [300, 300], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12", "vector": [8, 5, 0.6912, 0.0023, 5, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12", "label": "if", "type": "if", "loc": [301, 318], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12", "vector": [4, 5, 0.7131, 0.0415, 5, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L302_C16", "label": "expression", "type": "expression", "loc": [302, 302], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12", "vector": [8, 6, 0.6959, 0.0023, 6, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12", "label": "if", "type": "if", "loc": [303, 318], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12", "vector": [4, 6, 0.7154, 0.0369, 6, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L304_C16", "label": "expression", "type": "expression", "loc": [304, 304], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12", "vector": [8, 7, 0.7005, 0.0023, 7, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12", "label": "if", "type": "if", "loc": [305, 318], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12", "vector": [4, 7, 0.7177, 0.0323, 7, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L306_C16", "label": "expression", "type": "expression", "loc": [306, 306], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12", "vector": [8, 8, 0.7051, 0.0023, 8, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "label": "if", "type": "if", "loc": [307, 318], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12", "vector": [4, 8, 0.72, 0.0276, 8, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L308_C16", "label": "expression", "type": "expression", "loc": [308, 308], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "vector": [8, 9, 0.7097, 0.0023, 9, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L310_C16", "label": "expression", "type": "expression", "loc": [310, 310], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "vector": [8, 9, 0.7143, 0.0023, 9, 0.28, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16", "label": "if", "type": "if", "loc": [311, 316], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "vector": [4, 9, 0.7224, 0.0138, 9, 0.28, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L312_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [312, 312], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16", "vector": [14, 10, 0.7189, 0.0023, 10, 0.8, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16", "label": "if", "type": "if", "loc": [313, 316], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16", "vector": [4, 10, 0.7247, 0.0092, 10, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L314_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [314, 314], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16", "vector": [14, 11, 0.7235, 0.0023, 11, 0.04, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L316_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [316, 316], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16", "vector": [14, 11, 0.7281, 0.0023, 11, 0.04, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L317_C16", "label": "for chunk", "type": "for", "loc": [317, 318], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "vector": [6, 9, 0.7316, 0.0046, 9, 0.28, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L318_C20", "label": "expression", "type": "expression", "loc": [318, 318], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L317_C16", "vector": [8, 10, 0.7327, 0.0023, 10, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L319_C8", "label": "if", "type": "if", "loc": [319, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [4, 2, 0.7373, 0.0069, 2, 0.1, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L321_C12", "label": "expression", "type": "expression", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L319_C8", "vector": [8, 3, 0.7396, 0.0023, 3, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [8, 2, 0.7419, 0.0023, 2, 0.1, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L323_C8", "label": "if", "type": "if", "loc": [323, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "vector": [4, 2, 0.7454, 0.0046, 2, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "label": "_iterencode_dict", "type": "function", "loc": [326, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "vector": [2, 1, 0.8376, 0.1751, 1, 0.76, 0.3333, 301, 0, 2, 0, 0, 0, 0, 23], "semantic": {"name": "_iterencode_dict", "arg_names": ["dct", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_dict(dct, _current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8", "label": "if", "type": "if", "loc": [327, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.7558, 0.0069, 2, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dct:\n yield '{}'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L328_C12", "label": "expression", "type": "expression", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8", "vector": [8, 3, 0.7558, 0.0023, 3, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L329_C12", "label": "return", "type": "return", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8", "vector": [13, 3, 0.7581, 0.0023, 3, 0.42, 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_49:If_L330_C8", "label": "if", "type": "if", "loc": [330, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.765, 0.0115, 2, 0.73, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L331_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "vector": [14, 3, 0.7627, 0.0023, 3, 0.44, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(dct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L332_C12", "label": "if", "type": "if", "loc": [332, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "vector": [4, 3, 0.7661, 0.0046, 3, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L334_C12", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "vector": [14, 3, 0.7696, 0.0023, 3, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [8, 2, 0.7719, 0.0023, 2, 0.73, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "label": "if", "type": "if", "loc": [336, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.7823, 0.0184, 2, 0.73, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n item_separator = _item_separator + newline_indent\n yield newline_indent\n else:\n newline_indent = None\n item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L338_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "vector": [14, 3, 0.7788, 0.0023, 3, 0.28, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L339_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "vector": [14, 3, 0.7811, 0.0023, 3, 0.28, 0.25, 330, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L340_C12", "label": "expression", "type": "expression", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "vector": [8, 3, 0.7834, 0.0023, 3, 0.28, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L342_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "vector": [14, 3, 0.788, 0.0023, 3, 0.28, 0.75, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L343_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [343, 343], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "vector": [14, 3, 0.7903, 0.0023, 3, 0.28, 1.0, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L344_C8", "label": "first =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [14, 2, 0.7926, 0.0023, 2, 0.73, 0.4444, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "label": "if", "type": "if", "loc": [345, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.7995, 0.0115, 2, 0.73, 0.5556, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _sort_keys:\n items = dct.items()\n items.sort(key=lambda kv: kv[0])\n else:\n items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L346_C12", "label": "items = items()", "type": "assigned_variable", "loc": [346, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "vector": [14, 3, 0.7972, 0.0023, 3, 0.34, 0.0, 339, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " items = dct.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L347_C12", "label": "sort()", "type": "expression", "loc": [347, 347], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "vector": [8, 3, 0.7995, 0.0023, 3, 0.34, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " items.sort(key=lambda kv: kv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L349_C12", "label": "items = iteritems()", "type": "assigned_variable", "loc": [349, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "vector": [14, 3, 0.8041, 0.0023, 3, 0.34, 1.0, 339, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "label": "for key, value", "type": "for", "loc": [350, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [6, 2, 0.8583, 0.106, 2, 0.73, 0.6667, 839, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in items:\n if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L351_C12", "label": "if", "type": "if", "loc": [351, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "vector": [4, 3, 0.8283, 0.0415, 3, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12", "label": "if", "type": "if", "loc": [355, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L351_C12", "vector": [4, 4, 0.8329, 0.0323, 4, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L356_C16", "label": "key = _floatstr()", "type": "assigned_variable", "loc": [356, 356], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12", "vector": [14, 5, 0.8203, 0.0023, 5, 0.46, 0.0, 230, 3, 1, 0, 0, 185, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "_floatstr", "annotation": ""}, "snippet": " key = _floatstr(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12", "label": "if", "type": "if", "loc": [357, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12", "vector": [4, 5, 0.8353, 0.0276, 5, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L358_C16", "label": "key = str()", "type": "assigned_variable", "loc": [358, 358], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12", "vector": [14, 6, 0.8249, 0.0023, 6, 0.0, 0.0, 230, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12", "label": "if", "type": "if", "loc": [359, 368], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12", "vector": [4, 6, 0.8376, 0.023, 6, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L360_C16", "label": "key =", "type": "assigned_variable", "loc": [360, 360], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12", "vector": [14, 7, 0.8295, 0.0023, 7, 0.24, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12", "label": "if", "type": "if", "loc": [361, 368], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12", "vector": [4, 7, 0.8399, 0.0184, 7, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L362_C16", "label": "key =", "type": "assigned_variable", "loc": [362, 362], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12", "vector": [14, 8, 0.8341, 0.0023, 8, 0.61, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12", "label": "if", "type": "if", "loc": [363, 368], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12", "vector": [4, 8, 0.8422, 0.0138, 8, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L364_C16", "label": "key =", "type": "assigned_variable", "loc": [364, 364], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12", "vector": [14, 9, 0.8387, 0.0023, 9, 0.44, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L365_C12", "label": "if", "type": "if", "loc": [365, 368], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12", "vector": [4, 9, 0.8445, 0.0092, 9, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12", "label": "if", "type": "if", "loc": [369, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "vector": [4, 3, 0.8537, 0.0092, 3, 0.84, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L370_C16", "label": "first =", "type": "assigned_variable", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12", "vector": [14, 4, 0.8525, 0.0023, 4, 0.77, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L372_C16", "label": "expression", "type": "expression", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12", "vector": [8, 4, 0.8571, 0.0023, 4, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L373_C12", "label": "expression", "type": "expression", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "vector": [8, 3, 0.8594, 0.0023, 3, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L374_C12", "label": "expression", "type": "expression", "loc": [374, 374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "vector": [8, 3, 0.8618, 0.0023, 3, 0.84, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _key_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12", "label": "if", "type": "if", "loc": [375, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "vector": [4, 3, 0.8871, 0.0484, 3, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield _encoder(value)\n elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L376_C16", "label": "expression", "type": "expression", "loc": [376, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12", "vector": [8, 4, 0.8664, 0.0023, 4, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12", "label": "if", "type": "if", "loc": [377, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12", "vector": [4, 4, 0.8894, 0.0438, 4, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L378_C16", "label": "expression", "type": "expression", "loc": [378, 378], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12", "vector": [8, 5, 0.871, 0.0023, 5, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12", "label": "if", "type": "if", "loc": [379, 395], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12", "vector": [4, 5, 0.8917, 0.0392, 5, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L380_C16", "label": "expression", "type": "expression", "loc": [380, 380], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12", "vector": [8, 6, 0.8756, 0.0023, 6, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12", "label": "if", "type": "if", "loc": [381, 395], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12", "vector": [4, 6, 0.894, 0.0346, 6, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L382_C16", "label": "expression", "type": "expression", "loc": [382, 382], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12", "vector": [8, 7, 0.8802, 0.0023, 7, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12", "label": "if", "type": "if", "loc": [383, 395], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12", "vector": [4, 7, 0.8963, 0.03, 7, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L384_C16", "label": "expression", "type": "expression", "loc": [384, 384], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12", "vector": [8, 8, 0.8848, 0.0023, 8, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "label": "if", "type": "if", "loc": [385, 395], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12", "vector": [4, 8, 0.8986, 0.0253, 8, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L386_C16", "label": "expression", "type": "expression", "loc": [386, 386], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "vector": [8, 9, 0.8894, 0.0023, 9, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16", "label": "if", "type": "if", "loc": [388, 393], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "vector": [4, 9, 0.8998, 0.0138, 9, 0.06, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L389_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [389, 389], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16", "vector": [14, 10, 0.8963, 0.0023, 10, 0.96, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16", "label": "if", "type": "if", "loc": [390, 393], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16", "vector": [4, 10, 0.9021, 0.0092, 10, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L391_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [391, 391], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16", "vector": [14, 11, 0.9009, 0.0023, 11, 0.25, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L393_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [393, 393], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16", "vector": [14, 11, 0.9055, 0.0023, 11, 0.25, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L394_C16", "label": "for chunk", "type": "for", "loc": [394, 395], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "vector": [6, 9, 0.909, 0.0046, 9, 0.06, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L395_C20", "label": "expression", "type": "expression", "loc": [395, 395], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L394_C16", "vector": [8, 10, 0.9101, 0.0023, 10, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L396_C8", "label": "if", "type": "if", "loc": [396, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.9147, 0.0069, 2, 0.73, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L398_C12", "label": "expression", "type": "expression", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L396_C8", "vector": [8, 3, 0.9171, 0.0023, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L399_C8", "label": "expression", "type": "expression", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [8, 2, 0.9194, 0.0023, 2, 0.73, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L400_C8", "label": "if", "type": "if", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "vector": [4, 2, 0.9228, 0.0046, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L403_C4", "label": "_iterencode", "type": "function", "loc": [403, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "vector": [2, 1, 0.962, 0.0691, 1, 0.76, 0.6667, 136, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "_iterencode", "arg_names": ["o", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode(o, _current_indent_level):\n if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8", "label": "if", "type": "if", "loc": [404, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L403_C4", "vector": [4, 2, 0.9631, 0.0668, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L405_C12", "label": "expression", "type": "expression", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8", "vector": [8, 3, 0.9332, 0.0023, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8", "label": "if", "type": "if", "loc": [406, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8", "vector": [4, 3, 0.9654, 0.0622, 3, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L407_C12", "label": "expression", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8", "vector": [8, 4, 0.9378, 0.0023, 4, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8", "label": "if", "type": "if", "loc": [408, 432], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8", "vector": [4, 4, 0.9677, 0.0576, 4, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L409_C12", "label": "expression", "type": "expression", "loc": [409, 409], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8", "vector": [8, 5, 0.9424, 0.0023, 5, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8", "label": "if", "type": "if", "loc": [410, 432], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8", "vector": [4, 5, 0.97, 0.053, 5, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L411_C12", "label": "expression", "type": "expression", "loc": [411, 411], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8", "vector": [8, 6, 0.947, 0.0023, 6, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8", "label": "if", "type": "if", "loc": [412, 432], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8", "vector": [4, 6, 0.9724, 0.0484, 6, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L413_C12", "label": "expression", "type": "expression", "loc": [413, 413], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8", "vector": [8, 7, 0.9516, 0.0023, 7, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8", "label": "if", "type": "if", "loc": [414, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8", "vector": [4, 7, 0.9747, 0.0438, 7, 0.53, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L415_C12", "label": "expression", "type": "expression", "loc": [415, 415], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8", "vector": [8, 8, 0.9562, 0.0023, 8, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8", "label": "if", "type": "if", "loc": [416, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8", "vector": [4, 8, 0.977, 0.0392, 8, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L417_C12", "label": "for chunk", "type": "for", "loc": [417, 418], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8", "vector": [6, 9, 0.962, 0.0046, 9, 0.82, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L418_C16", "label": "expression", "type": "expression", "loc": [418, 418], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L417_C12", "vector": [8, 10, 0.9631, 0.0023, 10, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "label": "if", "type": "if", "loc": [419, 432], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8", "vector": [4, 9, 0.9804, 0.0323, 9, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L420_C12", "label": "for chunk", "type": "for", "loc": [420, 421], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "vector": [6, 10, 0.9689, 0.0046, 10, 0.45, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L421_C16", "label": "expression", "type": "expression", "loc": [421, 421], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L420_C12", "vector": [8, 11, 0.97, 0.0023, 11, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "label": "if", "type": "if", "loc": [423, 427], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "vector": [4, 10, 0.9793, 0.0115, 10, 0.45, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L424_C16", "label": "markerid = id()", "type": "assigned_variable", "loc": [424, 424], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "vector": [14, 11, 0.977, 0.0023, 11, 0.51, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L425_C16", "label": "if", "type": "if", "loc": [425, 426], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "vector": [4, 11, 0.9804, 0.0046, 11, 0.51, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L427_C16", "label": "assign", "type": "assigned_variable", "loc": [427, 427], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "vector": [14, 11, 0.9839, 0.0023, 11, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L428_C12", "label": "o = _default()", "type": "assigned_variable", "loc": [428, 428], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "vector": [14, 10, 0.9862, 0.0023, 10, 0.45, 0.5, 926, 3, 1, 0, 0, 99, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "_default", "annotation": ""}, "snippet": " o = _default(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:For_L429_C12", "label": "for chunk", "type": "for", "loc": [429, 430], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "vector": [6, 10, 0.9896, 0.0046, 10, 0.45, 0.75, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L430_C16", "label": "expression", "type": "expression", "loc": [430, 430], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:For_L429_C12", "vector": [8, 11, 0.9908, 0.0023, 11, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:If_L431_C12", "label": "if", "type": "if", "loc": [431, 432], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "vector": [4, 10, 0.9942, 0.0046, 10, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L434_C4", "label": "return", "type": "return", "loc": [434, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "vector": [13, 1, 1.0, 0.0023, 1, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L186_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L187_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L189_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L222_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L223_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L296_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L300_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L302_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L304_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L306_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L308_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L310_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L312_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L314_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L316_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L317_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L317_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L318_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L334_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L343_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L351_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L356_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L358_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L360_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L362_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L364_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L380_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L382_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L384_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L386_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L389_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L391_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L393_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L394_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L394_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L395_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L396_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L400_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L403_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L409_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L417_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L418_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L420_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L420_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L421_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L424_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L425_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L427_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Assign_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:For_L429_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:For_L429_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Expr_L430_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_49:If_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_49:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_49:Return_L434_C4"}]
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import simplejson as json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson as json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson as json >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) >>> print '\n'.join([l.rstrip() for l in s.splitlines()]) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson as json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import simplejson as json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> import decimal >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1') True Specializing JSON object encoding:: >>> import simplejson as json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError("%r is not JSON serializable" % (o,)) ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ __version__ = '2.0.7' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] from decoder import JSONDecoder from encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8', default=None, ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, **kw) def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN, null, true, false. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(encoding=encoding, **kw).decode(s)
ajibawa-2023/Python-Code-Large/train/row_50
41
316
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1582, 0.3133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility with Python 2.4 and Python 2.5 and (currently) has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L100_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.3165, 0.0032, 0, 0.66, 0.1, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '2.0.7'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L101_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [101, 104], "level": 0, "parent": null, "vector": [14, 0, 0.3244, 0.0127, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'dump', 'dumps', 'load', 'loads',\n 'JSONDecoder', 'JSONEncoder',\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:ImportFrom_L106_C0", "label": "from decoder import JSONDecoder", "type": "import", "loc": [106, 106], "level": 0, "parent": null, "vector": [1, 0, 0.3354, 0.0032, 0, 0.66, 0.3, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["JSONDecoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:ImportFrom_L107_C0", "label": "from encoder import JSONEncoder", "type": "import", "loc": [107, 107], "level": 0, "parent": null, "vector": [1, 0, 0.3386, 0.0032, 0, 0.66, 0.4, 672, 0, 1, 0, 0, 672, 0, 0], "semantic": {"name": "encoder", "arg_names": [], "import_names": ["JSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from encoder import JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L109_C0", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [109, 118], "level": 0, "parent": null, "vector": [14, 0, 0.3592, 0.0316, 0, 0.66, 0.5, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": "_default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "label": "dump", "type": "function", "loc": [120, 179], "level": 0, "parent": null, "vector": [2, 0, 0.4731, 0.1899, 0, 0.66, 0.6, 952, 0, 12, 0, 0, 0, 0, 4], "semantic": {"name": "dump", "arg_names": ["obj", "fp", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L123_C4", "label": "expression", "type": "expression", "loc": [123, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "vector": [8, 1, 0.4509, 0.1266, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "label": "if", "type": "if", "loc": [164, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "vector": [4, 1, 0.5364, 0.038, 1, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n iterable = _default_encoder.iterencode(obj)\n else:\n if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L168_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "vector": [14, 2, 0.5316, 0.0032, 2, 0.87, 0.0, 444, 3, 1, 0, 0, 315, 10, 1], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = _default_encoder.iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L170_C8", "label": "if", "type": "if", "loc": [170, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "vector": [4, 2, 0.5396, 0.0063, 2, 0.87, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L171_C12", "label": "cls =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L170_C8", "vector": [14, 3, 0.5411, 0.0032, 3, 0.52, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L172_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "vector": [14, 2, 0.5491, 0.0127, 2, 0.87, 1.0, 444, 3, 1, 0, 0, 315, 10, 2], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding,\n default=default, **kw).iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:For_L178_C4", "label": "for chunk", "type": "for", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "vector": [6, 1, 0.5649, 0.0063, 1, 0.44, 1.0, 637, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in iterable:\n fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L179_C8", "label": "write()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:For_L178_C4", "vector": [8, 2, 0.5665, 0.0032, 2, 0.43, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "label": "dumps", "type": "function", "loc": [182, 235], "level": 0, "parent": null, "vector": [2, 0, 0.6598, 0.1709, 0, 0.66, 0.7, 160, 0, 11, 1, 0, 0, 0, 3], "semantic": {"name": "dumps", "arg_names": ["obj", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L185_C4", "label": "expression", "type": "expression", "loc": [185, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "vector": [8, 1, 0.644, 0.1203, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the return value will be a\n ``unicode`` instance subject to normal Python ``str`` to ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "vector": [4, 1, 0.7152, 0.0158, 1, 0.97, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L224_C4", "vector": [13, 2, 0.7215, 0.0032, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L229_C4", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "vector": [4, 1, 0.7263, 0.0063, 1, 0.97, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L230_C8", "label": "cls =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L229_C4", "vector": [14, 2, 0.7278, 0.0032, 2, 0.79, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "vector": [13, 1, 0.7373, 0.0158, 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 cls(\n skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding, default=default,\n **kw).encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L238_C0", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [238, 238], "level": 0, "parent": null, "vector": [14, 0, 0.7532, 0.0032, 0, 0.66, 0.8, 340, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": "_default_decoder = JSONDecoder(encoding=None, object_hook=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L241_C0", "label": "load", "type": "function", "loc": [241, 265], "level": 0, "parent": null, "vector": [2, 0, 0.8006, 0.0791, 0, 0.66, 0.9, 37, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "load", "arg_names": ["fp", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L241_C0", "vector": [8, 1, 0.7975, 0.0601, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are\n not allowed, and should be wrapped with\n ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L241_C0", "vector": [13, 1, 0.8339, 0.0127, 1, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_constant=parse_constant, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "label": "loads", "type": "function", "loc": [268, 316], "level": 0, "parent": null, "vector": [2, 0, 0.9241, 0.1551, 0, 0.66, 1.0, 88, 0, 8, 1, 0, 0, 0, 3], "semantic": {"name": "loads", "arg_names": ["s", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L270_C4", "label": "expression", "type": "expression", "loc": [270, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [8, 1, 0.9035, 0.1013, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)\n are not allowed and should be decoded to ``unicode`` first.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L302_C4", "label": "if", "type": "if", "loc": [302, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9604, 0.0127, 1, 0.22, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None and not kw):\n return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L302_C4", "vector": [13, 2, 0.9652, 0.0032, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9699, 0.0063, 1, 0.22, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L307_C8", "label": "cls =", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L306_C4", "vector": [14, 2, 0.9715, 0.0032, 2, 0.7, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9763, 0.0063, 1, 0.22, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_hook is not None:\n kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L309_C8", "label": "assign", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L308_C4", "vector": [14, 2, 0.9778, 0.0032, 2, 0.32, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L310_C4", "label": "if", "type": "if", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9826, 0.0063, 1, 0.22, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_float is not None:\n kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L311_C8", "label": "assign", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L310_C4", "vector": [14, 2, 0.9842, 0.0032, 2, 0.58, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L312_C4", "label": "if", "type": "if", "loc": [312, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9889, 0.0063, 1, 0.22, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_int is not None:\n kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L313_C8", "label": "assign", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L312_C4", "vector": [14, 2, 0.9905, 0.0032, 2, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:If_L314_C4", "label": "if", "type": "if", "loc": [314, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [4, 1, 0.9953, 0.0063, 1, 0.22, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_constant is not None:\n kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L315_C8", "label": "assign", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:If_L314_C4", "vector": [14, 2, 0.9968, 0.0032, 2, 0.92, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "vector": [13, 1, 1.0, 0.0032, 1, 0.22, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(encoding=encoding, **kw).decode(s)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:For_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:For_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:If_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:If_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_50:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_50:Return_L316_C4"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''The setup and build script for the python-twitter library.''' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8.5' # The base package metadata to be used by both distutils and setuptools METADATA = dict( name = "python-twitter", version = __version__, py_modules = ['twitter'], author='The Python-Twitter Developers', author_email='python-twitter@googlegroups.com', description='A python wrapper around the Twitter API', license='Apache License 2.0', url='https://github.com/bear/python-twitter', keywords='twitter api', ) # Extra package metadata to be used only if setuptools is installed SETUPTOOLS_METADATA = dict( install_requires = ['setuptools', 'simplejson', 'oauth2'], include_package_data = True, classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Communications :: Chat', 'Topic :: Internet', ], test_suite = 'twitter_test.suite', ) def Read(file): return open(file).read() def BuildLongDescription(): return '\n'.join([Read('README.md'), Read('CHANGES')]) def Main(): # Build the long_description from the README and CHANGES METADATA['long_description'] = BuildLongDescription() # Use setuptools if available, otherwise fallback and use distutils try: import setuptools METADATA.update(SETUPTOOLS_METADATA) setuptools.setup(**METADATA) except ImportError: import distutils.core distutils.core.setup(**METADATA) if __name__ == '__main__': Main()
ajibawa-2023/Python-Code-Large/train/row_52
19
73
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2329, 0.0137, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''The setup and build script for the python-twitter library.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L19_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.2603, 0.0137, 0, 0.66, 0.125, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'python-twitter@googlegroups.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L20_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.274, 0.0137, 0, 0.66, 0.25, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '0.8.5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L24_C0", "label": "METADATA = dict()", "type": "assigned_variable", "loc": [24, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3973, 0.1507, 0, 0.66, 0.375, 622, 3, 9, 0, 0, 827, 10, 1], "semantic": {"name": "METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "METADATA = dict(\n name = \"python-twitter\",\n version = __version__,\n py_modules = ['twitter'],\n author='The Python-Twitter Developers',\n author_email='python-twitter@googlegroups.com',\n description='A python wrapper around the Twitter API',\n license='Apache License 2.0',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L37_C0", "label": "SETUPTOOLS_METADATA = dict()", "type": "assigned_variable", "loc": [37, 49], "level": 0, "parent": null, "vector": [14, 0, 0.589, 0.1781, 0, 0.66, 0.5, 22, 3, 4, 0, 0, 827, 10, 1], "semantic": {"name": "SETUPTOOLS_METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "SETUPTOOLS_METADATA = dict(\n install_requires = ['setuptools', 'simplejson', 'oauth2'],\n include_package_data = True,\n classifiers = [\n 'Development Status :: 4 - Beta',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: Apache Software License',\n 'Topic :: Software Development :: Libraries :: Python Modules',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L52_C0", "label": "Read", "type": "function", "loc": [52, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7192, 0.0274, 0, 0.66, 0.625, 771, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "Read", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Read(file):\n return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Return_L53_C2", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L52_C0", "vector": [13, 1, 0.726, 0.0137, 1, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L55_C0", "label": "BuildLongDescription", "type": "function", "loc": [55, 56], "level": 0, "parent": null, "vector": [2, 0, 0.7603, 0.0274, 0, 0.66, 0.75, 383, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "BuildLongDescription", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def BuildLongDescription():\n return '\\n'.join([Read('README.md'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L55_C0", "vector": [13, 1, 0.7671, 0.0137, 1, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join([Read('README.md'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L58_C0", "label": "Main", "type": "function", "loc": [58, 69], "level": 0, "parent": null, "vector": [2, 0, 0.8699, 0.1644, 0, 0.66, 0.875, 16, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "Main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Main():\n # Build the long_description from the README and CHANGES\n METADATA['long_description'] = BuildLongDescription()\n\n # Use setuptools if available, otherwise fallback and use distutils\n try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L60_C2", "label": " = BuildLongDescription()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L58_C0", "vector": [14, 1, 0.8219, 0.0137, 1, 0.82, 0.0, 0, 3, 0, 0, 0, 383, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "BuildLongDescription", "annotation": ""}, "snippet": " METADATA['long_description'] = BuildLongDescription()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "label": "try", "type": "try", "loc": [63, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L58_C0", "vector": [7, 1, 0.9041, 0.0959, 1, 0.82, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)\n setuptools.setup(**METADATA)\n except ImportError:\n import distutils.core\n distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Import_L64_C4", "label": "setuptools import setuptools", "type": "import", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "vector": [1, 2, 0.8767, 0.0137, 2, 0.51, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setuptools"], "rhs_call_name": "", "annotation": ""}, "snippet": " import setuptools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L65_C4", "label": "update()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "vector": [8, 2, 0.8904, 0.0137, 2, 0.51, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L66_C4", "label": "setup()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "vector": [8, 2, 0.9041, 0.0137, 2, 0.51, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " setuptools.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Import_L68_C4", "label": "distutils.core import distutils.core", "type": "import", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "vector": [1, 2, 0.9315, 0.0137, 2, 0.51, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["distutils.core"], "rhs_call_name": "", "annotation": ""}, "snippet": " import distutils.core"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L69_C4", "label": "setup()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "vector": [8, 2, 0.9452, 0.0137, 2, 0.51, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:If_L72_C0", "label": "if", "type": "if", "loc": [72, 73], "level": 0, "parent": null, "vector": [4, 0, 0.9932, 0.0274, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n Main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L73_C2", "label": "Main()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_52:If_L72_C0", "vector": [8, 1, 1.0, 0.0137, 1, 0.14, 0.0, 16, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Main", "arg_names": [], "import_names": [], "rhs_call_name": "Main", "annotation": ""}, "snippet": " Main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Return_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Import_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Import_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_52:If_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_52:Expr_L73_C2"}]
''' Module which brings history information about files from Mercurial. @author: Rodrigo Damazio ''' import re import subprocess REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*') def _GetOutputLines(args): ''' Runs an external process and returns its output as a list of lines. @param args: the arguments to run ''' process = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines = True, shell = False) output = process.communicate()[0] return output.splitlines() def FillMercurialRevisions(filename, parsed_file): ''' Fills the revs attribute of all strings in the given parsed file with a list of revisions that touched the lines corresponding to that string. @param filename: the name of the file to get history for @param parsed_file: the parsed file to modify ''' # Take output of hg annotate to get revision of each line output_lines = _GetOutputLines(['hg', 'annotate', '-c', filename]) # Create a map of line -> revision (key is list index, line 0 doesn't exist) line_revs = ['dummy'] for line in output_lines: rev_match = REVISION_REGEX.match(line) if not rev_match: raise 'Unexpected line of output from hg: %s' % line rev_hash = rev_match.group('hash') line_revs.append(rev_hash) for str in parsed_file.itervalues(): # Get the lines that correspond to each string start_line = str['startLine'] end_line = str['endLine'] # Get the revisions that touched those lines revs = [] for line_number in range(start_line, end_line + 1): revs.append(line_revs[line_number]) # Merge with any revisions that were already there # (for explict revision specification) if 'revs' in str: revs += str['revs'] # Assign the revisions to the string str['revs'] = frozenset(revs) def DoesRevisionSuperceed(filename, rev1, rev2): ''' Tells whether a revision superceeds another. This essentially means that the older revision is an ancestor of the newer one. This also returns True if the two revisions are the same. @param rev1: the revision that may be superceeding the other @param rev2: the revision that may be superceeded @return: True if rev1 superceeds rev2 or they're the same ''' if rev1 == rev2: return True # TODO: Add filename args = ['hg', 'log', '-r', 'ancestors(%s)' % rev1, '--template', '{node|short}\n', filename] output_lines = _GetOutputLines(args) return rev2 in output_lines def NewestRevision(filename, rev1, rev2): ''' Returns which of two revisions is closest to the head of the repository. If none of them is the ancestor of the other, then we return either one. @param rev1: the first revision @param rev2: the second revision ''' if DoesRevisionSuperceed(filename, rev1, rev2): return rev1 return rev2
ajibawa-2023/Python-Code-Large/train/row_55
38
94
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0532, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Import_L7_C0", "label": "re import re", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0745, 0.0106, 0, 0.66, 0.1429, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Import_L8_C0", "label": "subprocess import subprocess", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0106, 0, 0.66, 0.2857, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L10_C0", "label": "REVISION_REGEX = compile()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1064, 0.0106, 0, 0.66, 0.4286, 883, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "REVISION_REGEX", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "label": "_GetOutputLines", "type": "function", "loc": [12, 23], "level": 0, "parent": null, "vector": [2, 0, 0.1862, 0.1277, 0, 0.66, 0.5714, 359, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_GetOutputLines", "arg_names": ["args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines.\n\n @param args: the arguments to run\n '''\n process = subprocess.Popen(args,\n stdout=subprocess.PIPE,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L13_C2", "label": "expression", "type": "expression", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "vector": [8, 1, 0.1596, 0.0532, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Runs an external process and returns its output as a list of lines.\n\n @param args: the arguments to run\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L18_C2", "label": "process = Popen()", "type": "assigned_variable", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "vector": [14, 1, 0.2074, 0.0426, 1, 0.82, 0.3333, 712, 3, 4, 0, 0, 568, 10, 1], "semantic": {"name": "process", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " process = subprocess.Popen(args,\n stdout=subprocess.PIPE,\n universal_newlines = True,\n shell = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L22_C2", "label": "output =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "vector": [14, 1, 0.234, 0.0106, 1, 0.82, 0.6667, 886, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " output = process.communicate()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "vector": [13, 1, 0.2447, 0.0106, 1, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output.splitlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "label": "FillMercurialRevisions", "type": "function", "loc": [26, 62], "level": 0, "parent": null, "vector": [2, 0, 0.4681, 0.3936, 0, 0.66, 0.7143, 942, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "FillMercurialRevisions", "arg_names": ["filename", "parsed_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def FillMercurialRevisions(filename, parsed_file):\n '''\n Fills the revs attribute of all strings in the given parsed file with\n a list of revisions that touched the lines corresponding to that string.\n \n @param filename: the name of the file to get history for\n @param parsed_file: the parsed file to modify\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "vector": [8, 1, 0.3191, 0.0745, 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 Fills the revs attribute of all strings in the given parsed file with\n a list of revisions that touched the lines corresponding to that string.\n \n @param filename: the name of the file to get history for\n @param parsed_file: the parsed file to modify\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L35_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "vector": [14, 1, 0.3723, 0.0106, 1, 0.62, 0.25, 574, 3, 1, 0, 0, 359, 10, 1], "semantic": {"name": "output_lines", "arg_names": [], "import_names": [], "rhs_call_name": "_GetOutputLines", "annotation": ""}, "snippet": " output_lines = _GetOutputLines(['hg', 'annotate', '-c', filename])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L38_C2", "label": "line_revs =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "vector": [14, 1, 0.4043, 0.0106, 1, 0.62, 0.5, 348, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "line_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line_revs = ['dummy']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "label": "for line", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "vector": [6, 1, 0.4415, 0.0638, 1, 0.62, 0.75, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in output_lines:\n rev_match = REVISION_REGEX.match(line)\n if not rev_match:\n raise 'Unexpected line of output from hg: %s' % line\n rev_hash = rev_match.group('hash')\n line_revs.append(rev_hash)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L40_C4", "label": "rev_match = match()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "vector": [14, 2, 0.4255, 0.0106, 2, 0.22, 0.0, 931, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "rev_match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " rev_match = REVISION_REGEX.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "vector": [4, 2, 0.4415, 0.0213, 2, 0.22, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not rev_match:\n raise 'Unexpected line of output from hg: %s' % line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L43_C4", "label": "rev_hash = group()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "vector": [14, 2, 0.4574, 0.0106, 2, 0.22, 0.6667, 682, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "rev_hash", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " rev_hash = rev_match.group('hash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L44_C4", "label": "append()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "vector": [8, 2, 0.4681, 0.0106, 2, 0.22, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " line_revs.append(rev_hash)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "label": "for str", "type": "for", "loc": [46, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "vector": [6, 1, 0.5745, 0.1809, 1, 0.62, 1.0, 52, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for str in parsed_file.itervalues():\n # Get the lines that correspond to each string\n start_line = str['startLine']\n end_line = str['endLine']\n\n # Get the revisions that touched those lines\n revs = []\n for line_number in range(start_line, end_line + 1):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L48_C4", "label": "start_line =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [14, 2, 0.5106, 0.0106, 2, 0.19, 0.0, 501, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start_line = str['startLine']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L49_C4", "label": "end_line =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [14, 2, 0.5213, 0.0106, 2, 0.19, 0.2, 54, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_line = str['endLine']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L52_C4", "label": "revs =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [14, 2, 0.5532, 0.0106, 2, 0.19, 0.4, 848, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " revs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:For_L53_C4", "label": "for line_number", "type": "for", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [6, 2, 0.5691, 0.0213, 2, 0.19, 0.6, 490, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line_number in range(start_line, end_line + 1):\n revs.append(line_revs[line_number])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L54_C6", "label": "append()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L53_C4", "vector": [8, 3, 0.5745, 0.0106, 3, 0.82, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " revs.append(line_revs[line_number])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [4, 2, 0.6223, 0.0213, 2, 0.19, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'revs' in str:\n revs += str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L62_C4", "label": " = frozenset()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "vector": [14, 2, 0.6596, 0.0106, 2, 0.19, 1.0, 0, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " str['revs'] = frozenset(revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "label": "DoesRevisionSuperceed", "type": "function", "loc": [64, 82], "level": 0, "parent": null, "vector": [2, 0, 0.7766, 0.2021, 0, 0.66, 0.8571, 330, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "DoesRevisionSuperceed", "arg_names": ["filename", "rev1", "rev2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DoesRevisionSuperceed(filename, rev1, rev2):\n '''\n Tells whether a revision superceeds another.\n This essentially means that the older revision is an ancestor of the newer\n one.\n This also returns True if the two revisions are the same.\n\n @param rev1: the revision that may be superceeding the other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L65_C2", "label": "expression", "type": "expression", "loc": [65, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "vector": [8, 1, 0.7394, 0.1064, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Tells whether a revision superceeds another.\n This essentially means that the older revision is an ancestor of the newer\n one.\n This also returns True if the two revisions are the same.\n\n @param rev1: the revision that may be superceeding the other\n @param rev2: the revision that may be superceeded"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "vector": [4, 1, 0.8032, 0.0213, 1, 0.69, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev1 == rev2:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:If_L75_C2", "vector": [13, 2, 0.8085, 0.0106, 2, 0.15, 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_55:Assign_L79_C2", "label": "args =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "vector": [14, 1, 0.8404, 0.0106, 1, 0.69, 0.5, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = ['hg', 'log', '-r', 'ancestors(%s)' % rev1, '--template', '{node|short}\\n', filename]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L80_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "vector": [14, 1, 0.8511, 0.0106, 1, 0.69, 0.75, 574, 3, 1, 0, 0, 359, 10, 1], "semantic": {"name": "output_lines", "arg_names": [], "import_names": [], "rhs_call_name": "_GetOutputLines", "annotation": ""}, "snippet": " output_lines = _GetOutputLines(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "vector": [13, 1, 0.8723, 0.0106, 1, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev2 in output_lines"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "label": "NewestRevision", "type": "function", "loc": [84, 94], "level": 0, "parent": null, "vector": [2, 0, 0.9468, 0.117, 0, 0.66, 1.0, 256, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "NewestRevision", "arg_names": ["filename", "rev1", "rev2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def NewestRevision(filename, rev1, rev2):\n '''\n Returns which of two revisions is closest to the head of the repository.\n If none of them is the ancestor of the other, then we return either one.\n\n @param rev1: the first revision\n @param rev2: the second revision\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "vector": [8, 1, 0.9362, 0.0745, 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 Returns which of two revisions is closest to the head of the repository.\n If none of them is the ancestor of the other, then we return either one.\n\n @param rev1: the first revision\n @param rev2: the second revision\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:If_L92_C2", "label": "if", "type": "if", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "vector": [4, 1, 0.984, 0.0213, 1, 0.63, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DoesRevisionSuperceed(filename, rev1, rev2):\n return rev1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:If_L92_C2", "vector": [13, 2, 0.9894, 0.0106, 2, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "vector": [13, 1, 1.0, 0.0106, 1, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev2"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:For_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:If_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:If_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_55:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_55:Return_L94_C2"}]
#!/usr/bin/python ''' Entry point for My Tracks i18n tool. @author: Rodrigo Damazio ''' import mytracks.files import mytracks.translate import mytracks.validate import sys def Usage(): print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0] print 'Commands are:' print ' cleanup' print ' translate' print ' validate' sys.exit(1) def Translate(languages): ''' Asks the user to interactively translate any missing or oudated strings from the files for the given languages. @param languages: the languages to translate ''' validator = mytracks.validate.Validator(languages) validator.Validate() missing = validator.missing_in_lang() outdated = validator.outdated_in_lang() for lang in languages: untranslated = missing[lang] + outdated[lang] if len(untranslated) == 0: continue translator = mytracks.translate.Translator(lang) translator.Translate(untranslated) def Validate(languages): ''' Computes and displays errors in the string files for the given languages. @param languages: the languages to compute for ''' validator = mytracks.validate.Validator(languages) validator.Validate() error_count = 0 if (validator.valid()): print 'All files OK' else: for lang, missing in validator.missing_in_master().iteritems(): print 'Missing in master, present in %s: %s:' % (lang, str(missing)) error_count = error_count + len(missing) for lang, missing in validator.missing_in_lang().iteritems(): print 'Missing in %s, present in master: %s:' % (lang, str(missing)) error_count = error_count + len(missing) for lang, outdated in validator.outdated_in_lang().iteritems(): print 'Outdated in %s: %s:' % (lang, str(outdated)) error_count = error_count + len(outdated) return error_count if __name__ == '__main__': argv = sys.argv argc = len(argv) if argc < 2: Usage() languages = mytracks.files.GetAllLanguageFiles() if argc == 3: langs = set(argv[2:]) if not langs.issubset(languages): raise 'Language(s) not found' # Filter just to the languages specified languages = dict((lang, lang_file) for lang, lang_file in languages.iteritems() if lang in langs or lang == 'en' ) cmd = argv[1] if cmd == 'translate': Translate(languages) elif cmd == 'validate': error_count = Validate(languages) else: Usage() error_count = 0 print '%d errors found.' % error_count
ajibawa-2023/Python-Code-Large/train/row_56
58
96
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0521, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Import_L8_C0", "label": "mytracks.files import mytracks.files", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0104, 0, 0.66, 0.125, 640, 0, 1, 0, 0, 640, 0, 0], "semantic": {"name": "mytracks.files", "arg_names": [], "import_names": ["mytracks.files"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Import_L9_C0", "label": "mytracks.translate import mytracks.translate", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0104, 0, 0.66, 0.25, 802, 0, 1, 0, 0, 802, 0, 0], "semantic": {"name": "mytracks.translate", "arg_names": [], "import_names": ["mytracks.translate"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.translate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Import_L10_C0", "label": "mytracks.validate import mytracks.validate", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1042, 0.0104, 0, 0.66, 0.375, 355, 0, 1, 0, 0, 355, 0, 0], "semantic": {"name": "mytracks.validate", "arg_names": [], "import_names": ["mytracks.validate"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.validate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1146, 0.0104, 0, 0.66, 0.5, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "label": "Usage", "type": "function", "loc": [13, 19], "level": 0, "parent": null, "vector": [2, 0, 0.1667, 0.0729, 0, 0.66, 0.625, 208, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n print(' translate')\n print(' validate')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L14_C2", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1458, 0.0104, 1, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L15_C2", "label": "print()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1562, 0.0104, 1, 0.93, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Commands are:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L16_C2", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1667, 0.0104, 1, 0.93, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' cleanup')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L17_C2", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1771, 0.0104, 1, 0.93, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' translate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L18_C2", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1875, 0.0104, 1, 0.93, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' validate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L19_C2", "label": "exit()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "vector": [8, 1, 0.1979, 0.0104, 1, 0.93, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "label": "Translate", "type": "function", "loc": [22, 41], "level": 0, "parent": null, "vector": [2, 0, 0.3281, 0.2083, 0, 0.66, 0.75, 749, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "Translate", "arg_names": ["languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Translate(languages):\n '''\n Asks the user to interactively translate any missing or oudated strings from\n the files for the given languages.\n\n @param languages: the languages to translate\n '''\n validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [8, 1, 0.2656, 0.0625, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Asks the user to interactively translate any missing or oudated strings from\n the files for the given languages.\n\n @param languages: the languages to translate\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L29_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [14, 1, 0.3021, 0.0104, 1, 0.22, 0.2, 145, 3, 1, 0, 0, 957, 10, 1], "semantic": {"name": "validator", "arg_names": [], "import_names": [], "rhs_call_name": "Validator", "annotation": ""}, "snippet": " validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L30_C2", "label": "Validate()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [8, 1, 0.3125, 0.0104, 1, 0.22, 0.4, 60, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Validate", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L31_C2", "label": "missing = missing_in_lang()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [14, 1, 0.3229, 0.0104, 1, 0.22, 0.6, 249, 3, 0, 0, 0, 449, 10, 1], "semantic": {"name": "missing", "arg_names": [], "import_names": [], "rhs_call_name": "missing_in_lang", "annotation": ""}, "snippet": " missing = validator.missing_in_lang()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L32_C2", "label": "outdated = outdated_in_lang()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [14, 1, 0.3333, 0.0104, 1, 0.22, 0.8, 362, 3, 0, 0, 0, 862, 10, 1], "semantic": {"name": "outdated", "arg_names": [], "import_names": [], "rhs_call_name": "outdated_in_lang", "annotation": ""}, "snippet": " outdated = validator.outdated_in_lang()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "label": "for lang", "type": "for", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "vector": [6, 1, 0.3906, 0.0833, 1, 0.22, 1.0, 312, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang in languages:\n untranslated = missing[lang] + outdated[lang]\n \n if len(untranslated) == 0:\n continue\n\n translator = mytracks.translate.Translator(lang)\n translator.Translate(untranslated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L35_C4", "label": "untranslated =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "vector": [14, 2, 0.3646, 0.0104, 2, 0.3, 0.0, 493, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "untranslated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " untranslated = missing[lang] + outdated[lang]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "vector": [4, 2, 0.3906, 0.0208, 2, 0.3, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(untranslated) == 0:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L40_C4", "label": "translator = Translator()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "vector": [14, 2, 0.4167, 0.0104, 2, 0.3, 0.6667, 380, 3, 1, 0, 0, 229, 10, 1], "semantic": {"name": "translator", "arg_names": [], "import_names": [], "rhs_call_name": "Translator", "annotation": ""}, "snippet": " translator = mytracks.translate.Translator(lang)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L41_C4", "label": "Translate()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "vector": [8, 2, 0.4271, 0.0104, 2, 0.3, 1.0, 749, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": [], "import_names": [], "rhs_call_name": "Translate", "annotation": ""}, "snippet": " translator.Translate(untranslated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "label": "Validate", "type": "function", "loc": [44, 67], "level": 0, "parent": null, "vector": [2, 0, 0.5781, 0.25, 0, 0.66, 0.875, 60, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "Validate", "arg_names": ["languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Validate(languages):\n '''\n Computes and displays errors in the string files for the given languages.\n\n @param languages: the languages to compute for\n '''\n validator = mytracks.validate.Validator(languages)\n validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [8, 1, 0.4896, 0.0521, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes and displays errors in the string files for the given languages.\n\n @param languages: the languages to compute for\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L50_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.66, 0.2, 145, 3, 1, 0, 0, 957, 10, 1], "semantic": {"name": "validator", "arg_names": [], "import_names": [], "rhs_call_name": "Validator", "annotation": ""}, "snippet": " validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L51_C2", "label": "Validate()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [8, 1, 0.5312, 0.0104, 1, 0.66, 0.4, 60, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Validate", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L53_C2", "label": "error_count =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.66, 0.6, 59, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "label": "if", "type": "if", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [4, 1, 0.6198, 0.125, 1, 0.66, 0.8, 0, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (validator.valid()):\n print('All files OK')\n else:\n for lang, missing in validator.missing_in_master().iteritems():\n print('Missing in master, present in %s: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)\n for lang, missing in validator.missing_in_lang().iteritems():\n print('Missing in %s, present in master: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "vector": [8, 2, 0.5729, 0.0104, 2, 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('All files OK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4", "label": "for lang, missing", "type": "for", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "vector": [6, 2, 0.6042, 0.0312, 2, 0.39, 0.3333, 399, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, missing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, missing in validator.missing_in_master().iteritems():\n print('Missing in master, present in %s: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L58_C6", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4", "vector": [8, 3, 0.6042, 0.0104, 3, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Missing in master, present in %s: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L59_C6", "label": "error_count =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4", "vector": [14, 3, 0.6146, 0.0104, 3, 0.19, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4", "label": "for lang, missing", "type": "for", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "vector": [6, 2, 0.6354, 0.0312, 2, 0.39, 0.6667, 399, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, missing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, missing in validator.missing_in_lang().iteritems():\n print('Missing in %s, present in master: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L61_C6", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4", "vector": [8, 3, 0.6354, 0.0104, 3, 0.81, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Missing in %s, present in master: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L62_C6", "label": "error_count =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4", "vector": [14, 3, 0.6458, 0.0104, 3, 0.81, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4", "label": "for lang, outdated", "type": "for", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "vector": [6, 2, 0.6667, 0.0312, 2, 0.39, 1.0, 928, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, outdated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, outdated in validator.outdated_in_lang().iteritems():\n print('Outdated in %s: %s:' % (lang, str(outdated)))\n error_count = error_count + len(outdated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L64_C6", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4", "vector": [8, 3, 0.6667, 0.0104, 3, 0.46, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Outdated in %s: %s:' % (lang, str(outdated)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L65_C6", "label": "error_count =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4", "vector": [14, 3, 0.6771, 0.0104, 3, 0.46, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(outdated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "vector": [13, 1, 0.6979, 0.0104, 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 error_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "label": "if", "type": "if", "loc": [70, 96], "level": 0, "parent": null, "vector": [4, 0, 0.8646, 0.2812, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n argv = sys.argv\n argc = len(argv)\n if argc < 2:\n Usage()\n\n languages = mytracks.files.GetAllLanguageFiles()\n if argc == 3:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L71_C2", "label": "argv =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [14, 1, 0.7396, 0.0104, 1, 0.36, 0.0, 612, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "argv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " argv = sys.argv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L72_C2", "label": "argc = len()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [14, 1, 0.75, 0.0104, 1, 0.36, 0.1429, 123, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "argc", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " argc = len(argv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [4, 1, 0.7656, 0.0208, 1, 0.36, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argc < 2:\n Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L74_C4", "label": "Usage()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L73_C2", "vector": [8, 2, 0.7708, 0.0104, 2, 0.72, 0.0, 208, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "Usage", "annotation": ""}, "snippet": " Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L76_C2", "label": "languages = GetAllLanguageFiles()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [14, 1, 0.7917, 0.0104, 1, 0.36, 0.4286, 126, 3, 0, 0, 0, 438, 10, 1], "semantic": {"name": "languages", "arg_names": [], "import_names": [], "rhs_call_name": "GetAllLanguageFiles", "annotation": ""}, "snippet": " languages = mytracks.files.GetAllLanguageFiles()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "label": "if", "type": "if", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [4, 1, 0.8438, 0.0938, 1, 0.36, 0.5714, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argc == 3:\n langs = set(argv[2:])\n if not langs.issubset(languages):\n raise 'Language(s) not found'\n\n # Filter just to the languages specified\n languages = dict((lang, lang_file)\n for lang, lang_file in languages.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L78_C4", "label": "langs = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "vector": [14, 2, 0.8125, 0.0104, 2, 0.82, 0.0, 986, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "langs", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " langs = set(argv[2:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L79_C4", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "vector": [4, 2, 0.8281, 0.0208, 2, 0.82, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not langs.issubset(languages):\n raise 'Language(s) not found'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L83_C4", "label": "languages = dict()", "type": "assigned_variable", "loc": [83, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "vector": [14, 2, 0.875, 0.0312, 2, 0.82, 1.0, 126, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "languages", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " languages = dict((lang, lang_file)\n for lang, lang_file in languages.iteritems()\n if lang in langs or lang == 'en' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L87_C2", "label": "cmd =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [14, 1, 0.9062, 0.0104, 1, 0.36, 0.7143, 604, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [4, 1, 0.9479, 0.0729, 1, 0.36, 0.8571, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cmd == 'translate':\n Translate(languages)\n elif cmd == 'validate':\n error_count = Validate(languages)\n else:\n Usage()\n error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L89_C4", "label": "Translate()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.14, 0.0, 749, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": [], "import_names": [], "rhs_call_name": "Translate", "annotation": ""}, "snippet": " Translate(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2", "vector": [4, 2, 0.9583, 0.0521, 2, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif cmd == 'validate':\n error_count = Validate(languages)\n else:\n Usage()\n error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L91_C4", "label": "error_count = Validate()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "vector": [14, 3, 0.9479, 0.0104, 3, 0.36, 0.0, 59, 3, 1, 0, 0, 60, 10, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " error_count = Validate(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L93_C4", "label": "Usage()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "vector": [8, 3, 0.9688, 0.0104, 3, 0.36, 0.5, 208, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "Usage", "annotation": ""}, "snippet": " Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L94_C4", "label": "error_count =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "vector": [14, 3, 0.9792, 0.0104, 3, 0.36, 1.0, 59, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L96_C2", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "vector": [8, 1, 1.0, 0.0104, 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('%d errors found.' % error_count)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_56:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_56:Expr_L96_C2"}]
''' Module which prompts the user for translations and saves them. TODO: implement @author: Rodrigo Damazio ''' class Translator(object): ''' classdocs ''' def __init__(self, language): ''' Constructor ''' self._language = language def Translate(self, string_names): print string_names
ajibawa-2023/Python-Code-Large/train/row_57
8
21
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1905, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "label": "Translator", "type": "class", "loc": [9, 21], "level": 0, "parent": null, "vector": [3, 0, 0.7143, 0.619, 0, 0.66, 1.0, 229, 0, 2, 0, 0, 186, 0, 1], "semantic": {"name": "Translator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L10_C2", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "vector": [8, 1, 0.5238, 0.1429, 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 classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.2381, 1, 0.0, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "language"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, language):\n '''\n Constructor\n '''\n self._language = language"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2", "vector": [8, 2, 0.7619, 0.1429, 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 Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:Assign_L18_C4", "label": "self._language =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2", "vector": [14, 2, 0.8571, 0.0476, 2, 0.5, 1.0, 494, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._language", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._language = language"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L20_C2", "label": "Translate", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "vector": [2, 1, 0.9762, 0.0952, 1, 0.0, 1.0, 749, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": ["self", "string_names"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Translate(self, string_names):\n print(string_names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L20_C2", "vector": [8, 2, 1.0, 0.0476, 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(string_names)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_57:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_57:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_57:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_57:Expr_L21_C4"}]
''' Module which compares languague files to the master file and detects issues. @author: Rodrigo Damazio ''' import os from mytracks.parser import StringsParser import mytracks.history class Validator(object): def __init__(self, languages): ''' Builds a strings file validator. Params: @param languages: a dictionary mapping each language to its corresponding directory ''' self._langs = {} self._master = None self._language_paths = languages parser = StringsParser() for lang, lang_dir in languages.iteritems(): filename = os.path.join(lang_dir, 'strings.xml') parsed_file = parser.Parse(filename) mytracks.history.FillMercurialRevisions(filename, parsed_file) if lang == 'en': self._master = parsed_file else: self._langs[lang] = parsed_file self._Reset() def Validate(self): ''' Computes whether all the data in the files for the given languages is valid. ''' self._Reset() self._ValidateMissingKeys() self._ValidateOutdatedKeys() def valid(self): return (len(self._missing_in_master) == 0 and len(self._missing_in_lang) == 0 and len(self._outdated_in_lang) == 0) def missing_in_master(self): return self._missing_in_master def missing_in_lang(self): return self._missing_in_lang def outdated_in_lang(self): return self._outdated_in_lang def _Reset(self): # These are maps from language to string name list self._missing_in_master = {} self._missing_in_lang = {} self._outdated_in_lang = {} def _ValidateMissingKeys(self): ''' Computes whether there are missing keys on either side. ''' master_keys = frozenset(self._master.iterkeys()) for lang, file in self._langs.iteritems(): keys = frozenset(file.iterkeys()) missing_in_master = keys - master_keys missing_in_lang = master_keys - keys if len(missing_in_master) > 0: self._missing_in_master[lang] = missing_in_master if len(missing_in_lang) > 0: self._missing_in_lang[lang] = missing_in_lang def _ValidateOutdatedKeys(self): ''' Computers whether any of the language keys are outdated with relation to the master keys. ''' for lang, file in self._langs.iteritems(): outdated = [] for key, str in file.iteritems(): # Get all revisions that touched master and language files for this # string. master_str = self._master[key] master_revs = master_str['revs'] lang_revs = str['revs'] if not master_revs or not lang_revs: print 'WARNING: No revision for %s in %s' % (key, lang) continue master_file = os.path.join(self._language_paths['en'], 'strings.xml') lang_file = os.path.join(self._language_paths[lang], 'strings.xml') # Assume that the repository has a single head (TODO: check that), # and as such there is always one revision which superceeds all others. master_rev = reduce( lambda r1, r2: mytracks.history.NewestRevision(master_file, r1, r2), master_revs) lang_rev = reduce( lambda r1, r2: mytracks.history.NewestRevision(lang_file, r1, r2), lang_revs) # If the master version is newer than the lang version if mytracks.history.DoesRevisionSuperceed(lang_file, master_rev, lang_rev): outdated.append(key) if len(outdated) > 0: self._outdated_in_lang[lang] = outdated
ajibawa-2023/Python-Code-Large/train/row_58
65
115
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0304, 0.0522, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0696, 0.0087, 0, 0.66, 0.25, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:ImportFrom_L9_C0", "label": "from mytracks.parser import StringsParser", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0783, 0.0087, 0, 0.66, 0.5, 161, 0, 1, 0, 0, 161, 0, 0], "semantic": {"name": "mytracks.parser", "arg_names": [], "import_names": ["StringsParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mytracks.parser import StringsParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Import_L10_C0", "label": "mytracks.history import mytracks.history", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0087, 0, 0.66, 0.75, 247, 0, 1, 0, 0, 247, 0, 0], "semantic": {"name": "mytracks.history", "arg_names": [], "import_names": ["mytracks.history"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.history "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "label": "Validator", "type": "class", "loc": [12, 115], "level": 0, "parent": null, "vector": [3, 0, 0.5522, 0.9043, 0, 0.66, 1.0, 957, 0, 9, 0, 0, 186, 0, 31], "semantic": {"name": "Validator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.2174, 0.2, 1, 0.82, 0.0, 555, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, languages):\n '''\n Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory\n '''\n self._langs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [8, 2, 0.1522, 0.0522, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L21_C4", "label": "self._langs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [14, 2, 0.1826, 0.0087, 2, 0.83, 0.1667, 591, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._langs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._langs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L22_C4", "label": "self._master =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [14, 2, 0.1913, 0.0087, 2, 0.83, 0.3333, 265, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._master = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L23_C4", "label": "self._language_paths =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [14, 2, 0.2, 0.0087, 2, 0.83, 0.5, 356, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._language_paths", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._language_paths = languages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L25_C4", "label": "parser = StringsParser()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [14, 2, 0.2174, 0.0087, 2, 0.83, 0.6667, 968, 3, 0, 0, 0, 282, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "StringsParser", "annotation": ""}, "snippet": " parser = StringsParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "label": "for lang, lang_dir", "type": "for", "loc": [26, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [6, 2, 0.2609, 0.0783, 2, 0.83, 0.8333, 114, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "lang, lang_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, lang_dir in languages.iteritems():\n filename = os.path.join(lang_dir, 'strings.xml')\n parsed_file = parser.Parse(filename)\n mytracks.history.FillMercurialRevisions(filename, parsed_file)\n\n if lang == 'en':\n self._master = parsed_file\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L27_C6", "label": "filename = join()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "vector": [14, 3, 0.2348, 0.0087, 3, 0.87, 0.0, 275, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " filename = os.path.join(lang_dir, 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L28_C6", "label": "parsed_file = Parse()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "vector": [14, 3, 0.2435, 0.0087, 3, 0.87, 0.3333, 76, 3, 1, 0, 0, 291, 10, 1], "semantic": {"name": "parsed_file", "arg_names": [], "import_names": [], "rhs_call_name": "Parse", "annotation": ""}, "snippet": " parsed_file = parser.Parse(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L29_C6", "label": "FillMercurialRevisions()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "vector": [8, 3, 0.2522, 0.0087, 3, 0.87, 0.6667, 942, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "FillMercurialRevisions", "arg_names": [], "import_names": [], "rhs_call_name": "FillMercurialRevisions", "annotation": ""}, "snippet": " mytracks.history.FillMercurialRevisions(filename, parsed_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "vector": [4, 3, 0.2826, 0.0348, 3, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lang == 'en':\n self._master = parsed_file\n else:\n self._langs[lang] = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L32_C8", "label": "self._master =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6", "vector": [14, 4, 0.2783, 0.0087, 4, 0.86, 0.0, 265, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._master = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L34_C8", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6", "vector": [14, 4, 0.2957, 0.0087, 4, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._langs[lang] = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L36_C4", "label": "_Reset()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "vector": [8, 2, 0.313, 0.0087, 2, 0.83, 1.0, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "label": "Validate", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.3565, 0.0609, 1, 0.82, 0.125, 60, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "Validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Validate(self):\n '''\n Computes whether all the data in the files for the given languages is valid.\n '''\n self._Reset()\n self._ValidateMissingKeys()\n self._ValidateOutdatedKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "vector": [8, 2, 0.3478, 0.0261, 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 Computes whether all the data in the files for the given languages is valid.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L42_C4", "label": "_Reset()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "vector": [8, 2, 0.3652, 0.0087, 2, 0.55, 0.3333, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L43_C4", "label": "_ValidateMissingKeys()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "vector": [8, 2, 0.3739, 0.0087, 2, 0.55, 0.6667, 427, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_ValidateMissingKeys", "arg_names": [], "import_names": [], "rhs_call_name": "_ValidateMissingKeys", "annotation": ""}, "snippet": " self._ValidateMissingKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L44_C4", "label": "_ValidateOutdatedKeys()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "vector": [8, 2, 0.3826, 0.0087, 2, 0.55, 1.0, 676, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_ValidateOutdatedKeys", "arg_names": [], "import_names": [], "rhs_call_name": "_ValidateOutdatedKeys", "annotation": ""}, "snippet": " self._ValidateOutdatedKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L46_C2", "label": "valid", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.413, 0.0348, 1, 0.82, 0.25, 552, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "valid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def valid(self):\n return (len(self._missing_in_master) == 0 and\n len(self._missing_in_lang) == 0 and\n len(self._outdated_in_lang) == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L46_C2", "vector": [13, 2, 0.4174, 0.0261, 2, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (len(self._missing_in_master) == 0 and\n len(self._missing_in_lang) == 0 and\n len(self._outdated_in_lang) == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L51_C2", "label": "missing_in_master", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.4478, 0.0174, 1, 0.82, 0.375, 277, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "missing_in_master", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def missing_in_master(self):\n return self._missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L51_C2", "vector": [13, 2, 0.4522, 0.0087, 2, 0.34, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L54_C2", "label": "missing_in_lang", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.4739, 0.0174, 1, 0.82, 0.5, 449, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "missing_in_lang", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def missing_in_lang(self):\n return self._missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L54_C2", "vector": [13, 2, 0.4783, 0.0087, 2, 0.77, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L57_C2", "label": "outdated_in_lang", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.5, 0.0174, 1, 0.82, 0.625, 862, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "outdated_in_lang", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def outdated_in_lang(self):\n return self._outdated_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L57_C2", "vector": [13, 2, 0.5043, 0.0087, 2, 0.36, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._outdated_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "label": "_Reset", "type": "function", "loc": [60, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.5391, 0.0435, 1, 0.82, 0.75, 412, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_Reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Reset(self):\n # These are maps from language to string name list\n self._missing_in_master = {}\n self._missing_in_lang = {}\n self._outdated_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L62_C4", "label": "self._missing_in_master =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "vector": [14, 2, 0.5391, 0.0087, 2, 0.78, 0.0, 252, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._missing_in_master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_master = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L63_C4", "label": "self._missing_in_lang =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "vector": [14, 2, 0.5478, 0.0087, 2, 0.78, 0.5, 473, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._missing_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L64_C4", "label": "self._outdated_in_lang =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "vector": [14, 2, 0.5565, 0.0087, 2, 0.78, 1.0, 575, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._outdated_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._outdated_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "label": "_ValidateMissingKeys", "type": "function", "loc": [66, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.6304, 0.1217, 1, 0.82, 0.875, 427, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "_ValidateMissingKeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _ValidateMissingKeys(self):\n '''\n Computes whether there are missing keys on either side.\n '''\n master_keys = frozenset(self._master.iterkeys())\n for lang, file in self._langs.iteritems():\n keys = frozenset(file.iterkeys())\n missing_in_master = keys - master_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "vector": [8, 2, 0.5913, 0.0261, 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 Computes whether there are missing keys on either side.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L70_C4", "label": "master_keys = frozenset()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "vector": [14, 2, 0.6087, 0.0087, 2, 0.94, 0.5, 468, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "master_keys", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " master_keys = frozenset(self._master.iterkeys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "label": "for lang, file", "type": "for", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "vector": [6, 2, 0.6522, 0.0783, 2, 0.94, 1.0, 275, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, file in self._langs.iteritems():\n keys = frozenset(file.iterkeys())\n missing_in_master = keys - master_keys\n missing_in_lang = master_keys - keys\n\n if len(missing_in_master) > 0:\n self._missing_in_master[lang] = missing_in_master\n if len(missing_in_lang) > 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L72_C6", "label": "keys = frozenset()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.22, 0.0, 204, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " keys = frozenset(file.iterkeys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L73_C6", "label": "missing_in_master =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "vector": [14, 3, 0.6348, 0.0087, 3, 0.22, 0.25, 277, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "missing_in_master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " missing_in_master = keys - master_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L74_C6", "label": "missing_in_lang =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "vector": [14, 3, 0.6435, 0.0087, 3, 0.22, 0.5, 449, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "missing_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " missing_in_lang = master_keys - keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L76_C6", "label": "if", "type": "if", "loc": [76, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "vector": [4, 3, 0.6652, 0.0174, 3, 0.22, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(missing_in_master) > 0:\n self._missing_in_master[lang] = missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L77_C8", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L76_C6", "vector": [14, 4, 0.6696, 0.0087, 4, 0.21, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_master[lang] = missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L78_C6", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "vector": [4, 3, 0.6826, 0.0174, 3, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(missing_in_lang) > 0:\n self._missing_in_lang[lang] = missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L79_C8", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L78_C6", "vector": [14, 4, 0.687, 0.0087, 4, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_lang[lang] = missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2", "label": "_ValidateOutdatedKeys", "type": "function", "loc": [81, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "vector": [2, 1, 0.8522, 0.3043, 1, 0.82, 1.0, 676, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "_ValidateOutdatedKeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _ValidateOutdatedKeys(self):\n '''\n Computers whether any of the language keys are outdated with relation to the\n master keys.\n '''\n for lang, file in self._langs.iteritems():\n outdated = []\n for key, str in file.iteritems():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2", "vector": [8, 2, 0.7261, 0.0348, 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 Computers whether any of the language keys are outdated with relation to the\n master keys.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "label": "for lang, file", "type": "for", "loc": [86, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2", "vector": [6, 2, 0.8739, 0.2609, 2, 0.36, 1.0, 275, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "lang, file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, file in self._langs.iteritems():\n outdated = []\n for key, str in file.iteritems():\n # Get all revisions that touched master and language files for this\n # string.\n master_str = self._master[key]\n master_revs = master_str['revs']\n lang_revs = str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L87_C6", "label": "outdated =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "vector": [14, 3, 0.7565, 0.0087, 3, 0.55, 0.0, 362, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "outdated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " outdated = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "label": "for key, str", "type": "for", "loc": [88, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "vector": [6, 3, 0.8696, 0.2174, 3, 0.55, 0.5, 83, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "key, str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, str in file.iteritems():\n # Get all revisions that touched master and language files for this\n # string.\n master_str = self._master[key]\n master_revs = master_str['revs']\n lang_revs = str['revs']\n if not master_revs or not lang_revs:\n print('WARNING: No revision for %s in %s' % (key, lang))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L91_C8", "label": "master_str =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.7913, 0.0087, 4, 0.91, 0.0, 440, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "master_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " master_str = self._master[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L92_C8", "label": "master_revs =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.8, 0.0087, 4, 0.91, 0.125, 616, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "master_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " master_revs = master_str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L93_C8", "label": "lang_revs =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.8087, 0.0087, 4, 0.91, 0.25, 522, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang_revs = str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L94_C8", "label": "if", "type": "if", "loc": [94, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [4, 4, 0.8261, 0.0261, 4, 0.91, 0.375, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not master_revs or not lang_revs:\n print('WARNING: No revision for %s in %s' % (key, lang))\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L95_C10", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L94_C8", "vector": [8, 5, 0.8261, 0.0087, 5, 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('WARNING: No revision for %s in %s' % (key, lang))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L98_C8", "label": "master_file = join()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.8522, 0.0087, 4, 0.91, 0.5, 377, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "master_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " master_file = os.path.join(self._language_paths['en'], 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L99_C8", "label": "lang_file = join()", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.8609, 0.0087, 4, 0.91, 0.625, 906, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "lang_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " lang_file = os.path.join(self._language_paths[lang], 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L103_C8", "label": "master_rev = reduce()", "type": "assigned_variable", "loc": [103, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.9043, 0.0261, 4, 0.91, 0.75, 609, 3, 2, 0, 0, 622, 10, 2], "semantic": {"name": "master_rev", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " master_rev = reduce(\n lambda r1, r2: mytracks.history.NewestRevision(master_file, r1, r2),\n master_revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L106_C8", "label": "lang_rev = reduce()", "type": "assigned_variable", "loc": [106, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [14, 4, 0.9304, 0.0261, 4, 0.91, 0.875, 74, 3, 2, 0, 0, 622, 10, 2], "semantic": {"name": "lang_rev", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " lang_rev = reduce(\n lambda r1, r2: mytracks.history.NewestRevision(lang_file, r1, r2),\n lang_revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "vector": [4, 4, 0.9696, 0.0174, 4, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mytracks.history.DoesRevisionSuperceed(lang_file, master_rev, lang_rev):\n outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L112_C10", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L111_C8", "vector": [8, 5, 0.9739, 0.0087, 5, 0.39, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:If_L114_C6", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "vector": [4, 3, 0.9957, 0.0174, 3, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(outdated) > 0:\n self._outdated_in_lang[lang] = outdated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_58:If_L114_C6", "vector": [14, 4, 1.0, 0.0087, 4, 0.96, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._outdated_in_lang[lang] = outdated"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L76_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L78_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L95_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Expr_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_58:If_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_58:If_L114_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_58:Assign_L115_C8"}]
''' Module for dealing with resource files (but not their contents). @author: Rodrigo Damazio ''' import os.path from glob import glob import re MYTRACKS_RES_DIR = 'MyTracks/res' ANDROID_MASTER_VALUES = 'values' ANDROID_VALUES_MASK = 'values-*' def GetMyTracksDir(): ''' Returns the directory in which the MyTracks directory is located. ''' path = os.getcwd() while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)): if path == '/': raise 'Not in My Tracks project' # Go up one level path = os.path.split(path)[0] return path def GetAllLanguageFiles(): ''' Returns a mapping from all found languages to their respective directories. ''' mytracks_path = GetMyTracksDir() res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK) language_dirs = glob(res_dir) master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES) if len(language_dirs) == 0: raise 'No languages found!' if not os.path.isdir(master_dir): raise 'Couldn\'t find master file' language_tuples = [(re.findall(r'.*values-([A-Za-z-]+)', dir)[0],dir) for dir in language_dirs] language_tuples.append(('en', master_dir)) return dict(language_tuples)
ajibawa-2023/Python-Code-Large/train/row_59
25
45
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nModule for dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Import_L6_C0", "label": "os.path import os.path", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1333, 0.0222, 0, 0.66, 0.125, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["os.path"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:ImportFrom_L7_C0", "label": "from glob import glob", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1556, 0.0222, 0, 0.66, 0.25, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "from glob import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Import_L8_C0", "label": "re import re", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1778, 0.0222, 0, 0.66, 0.375, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L10_C0", "label": "MYTRACKS_RES_DIR =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.2222, 0.0222, 0, 0.66, 0.5, 40, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MYTRACKS_RES_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MYTRACKS_RES_DIR = 'MyTracks/res'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L11_C0", "label": "ANDROID_MASTER_VALUES =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2444, 0.0222, 0, 0.66, 0.625, 918, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANDROID_MASTER_VALUES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ANDROID_MASTER_VALUES = 'values'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L12_C0", "label": "ANDROID_VALUES_MASK =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.2667, 0.0222, 0, 0.66, 0.75, 115, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANDROID_VALUES_MASK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ANDROID_VALUES_MASK = 'values-*'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "label": "GetMyTracksDir", "type": "function", "loc": [15, 27], "level": 0, "parent": null, "vector": [2, 0, 0.4667, 0.2889, 0, 0.66, 0.875, 854, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "GetMyTracksDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetMyTracksDir():\n '''\n Returns the directory in which the MyTracks directory is located.\n '''\n path = os.getcwd()\n while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)):\n if path == '/':\n raise 'Not in My Tracks project'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L16_C2", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "vector": [8, 1, 0.3778, 0.0667, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns the directory in which the MyTracks directory is located.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L19_C2", "label": "path = getcwd()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "vector": [14, 1, 0.4222, 0.0222, 1, 0.84, 0.3333, 358, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2", "label": "while", "type": "while", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "vector": [5, 1, 0.5, 0.1333, 1, 0.84, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)):\n if path == '/':\n raise 'Not in My Tracks project'\n\n # Go up one level\n path = os.path.split(path)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2", "vector": [4, 2, 0.4778, 0.0444, 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 path == '/':\n raise 'Not in My Tracks project'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L25_C4", "label": "path =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2", "vector": [14, 2, 0.5556, 0.0222, 2, 0.49, 1.0, 358, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = os.path.split(path)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "vector": [13, 1, 0.6, 0.0222, 1, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "label": "GetAllLanguageFiles", "type": "function", "loc": [30, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8333, 0.3556, 0, 0.66, 1.0, 438, 0, 0, 1, 0, 0, 0, 9], "semantic": {"name": "GetAllLanguageFiles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAllLanguageFiles():\n '''\n Returns a mapping from all found languages to their respective directories.\n '''\n mytracks_path = GetMyTracksDir()\n res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK)\n language_dirs = glob(res_dir)\n master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [8, 1, 0.7111, 0.0667, 1, 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 a mapping from all found languages to their respective directories.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L34_C2", "label": "mytracks_path = GetMyTracksDir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [14, 1, 0.7556, 0.0222, 1, 0.5, 0.1111, 720, 3, 0, 0, 0, 854, 10, 1], "semantic": {"name": "mytracks_path", "arg_names": [], "import_names": [], "rhs_call_name": "GetMyTracksDir", "annotation": ""}, "snippet": " mytracks_path = GetMyTracksDir()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L35_C2", "label": "res_dir = join()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [14, 1, 0.7778, 0.0222, 1, 0.5, 0.2222, 400, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "res_dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L36_C2", "label": "language_dirs = glob()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [14, 1, 0.8, 0.0222, 1, 0.5, 0.3333, 191, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "language_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "glob", "annotation": ""}, "snippet": " language_dirs = glob(res_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L37_C2", "label": "master_dir = join()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [14, 1, 0.8222, 0.0222, 1, 0.5, 0.4444, 493, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "master_dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [4, 1, 0.8556, 0.0444, 1, 0.5, 0.5556, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(language_dirs) == 0:\n raise 'No languages found!'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [4, 1, 0.9, 0.0444, 1, 0.5, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isdir(master_dir):\n raise 'Couldn\\'t find master file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L43_C2", "label": "language_tuples =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [14, 1, 0.9556, 0.0222, 1, 0.5, 0.7778, 966, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "language_tuples", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " language_tuples = [(re.findall(r'.*values-([A-Za-z-]+)', dir)[0],dir) for dir in language_dirs]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L44_C2", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [8, 1, 0.9778, 0.0222, 1, 0.5, 0.8889, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " language_tuples.append(('en', master_dir))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_59:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "vector": [13, 1, 1.0, 0.0222, 1, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(language_tuples)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_59:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_59:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_59:Return_L45_C2"}]
''' Module which parses a string XML file. @author: Rodrigo Damazio ''' from xml.parsers.expat import ParserCreate import re #import xml.etree.ElementTree as ET class StringsParser(object): ''' Parser for string XML files. This object is not thread-safe and should be used for parsing a single file at a time, only. ''' def Parse(self, file): ''' Parses the given file and returns a dictionary mapping keys to an object with attributes for that key, such as the value, start/end line and explicit revisions. In addition to the standard XML format of the strings file, this parser supports an annotation inside comments, in one of these formats: <!-- KEEP_PARENT name="bla" --> <!-- KEEP_PARENT name="bla" rev="123456789012" --> Such an annotation indicates that we're explicitly inheriting form the master file (and the optional revision says that this decision is compatible with the master file up to that revision). @param file: the name of the file to parse ''' self._Reset() # Unfortunately expat is the only parser that will give us line numbers self._xml_parser = ParserCreate() self._xml_parser.StartElementHandler = self._StartElementHandler self._xml_parser.EndElementHandler = self._EndElementHandler self._xml_parser.CharacterDataHandler = self._CharacterDataHandler self._xml_parser.CommentHandler = self._CommentHandler file_obj = open(file) self._xml_parser.ParseFile(file_obj) file_obj.close() return self._all_strings def _Reset(self): self._currentString = None self._currentStringName = None self._currentStringValue = None self._all_strings = {} def _StartElementHandler(self, name, attrs): if name != 'string': return if 'name' not in attrs: return assert not self._currentString assert not self._currentStringName self._currentString = { 'startLine' : self._xml_parser.CurrentLineNumber, } if 'rev' in attrs: self._currentString['revs'] = [attrs['rev']] self._currentStringName = attrs['name'] self._currentStringValue = '' def _EndElementHandler(self, name): if name != 'string': return assert self._currentString assert self._currentStringName self._currentString['value'] = self._currentStringValue self._currentString['endLine'] = self._xml_parser.CurrentLineNumber self._all_strings[self._currentStringName] = self._currentString self._currentString = None self._currentStringName = None self._currentStringValue = None def _CharacterDataHandler(self, data): if not self._currentString: return self._currentStringValue += data _KEEP_PARENT_REGEX = re.compile(r'\s*KEEP_PARENT\s+' r'name\s*=\s*[\'"]?(?P<name>[a-z0-9_]+)[\'"]?' r'(?:\s+rev=[\'"]?(?P<rev>[0-9a-f]{12})[\'"]?)?\s*', re.MULTILINE | re.DOTALL) def _CommentHandler(self, data): keep_parent_match = self._KEEP_PARENT_REGEX.match(data) if not keep_parent_match: return name = keep_parent_match.group('name') self._all_strings[name] = { 'keepParent' : True, 'startLine' : self._xml_parser.CurrentLineNumber, 'endLine' : self._xml_parser.CurrentLineNumber } rev = keep_parent_match.group('rev') if rev: self._all_strings[name]['revs'] = [rev]
ajibawa-2023/Python-Code-Large/train/row_60
54
115
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0435, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:ImportFrom_L7_C0", "label": "from xml.parsers.expat import ParserCreate", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0609, 0.0087, 0, 0.66, 0.3333, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "xml.parsers.expat", "arg_names": [], "import_names": ["ParserCreate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.parsers.expat import ParserCreate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Import_L8_C0", "label": "re import re", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0696, 0.0087, 0, 0.66, 0.6667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "label": "StringsParser", "type": "class", "loc": [11, 115], "level": 0, "parent": null, "vector": [3, 0, 0.5478, 0.913, 0, 0.66, 1.0, 282, 0, 6, 0, 0, 186, 0, 9], "semantic": {"name": "StringsParser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n '''\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [8, 1, 0.1261, 0.0522, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "label": "Parse", "type": "function", "loc": [19, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.3, 0.2783, 1, 0.56, 0.1429, 291, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "Parse", "arg_names": ["self", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Parse(self, file):\n '''\n Parses the given file and returns a dictionary mapping keys to an object\n with attributes for that key, such as the value, start/end line and explicit\n revisions.\n \n In addition to the standard XML format of the strings file, this parser\n supports an annotation inside comments, in one of these formats:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [8, 2, 0.2435, 0.1478, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Parses the given file and returns a dictionary mapping keys to an object\n with attributes for that key, such as the value, start/end line and explicit\n revisions.\n \n In addition to the standard XML format of the strings file, this parser\n supports an annotation inside comments, in one of these formats:\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L37_C4", "label": "_Reset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [8, 2, 0.3217, 0.0087, 2, 0.65, 0.1, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L40_C4", "label": "self._xml_parser = ParserCreate()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.3478, 0.0087, 2, 0.65, 0.2, 822, 3, 0, 0, 0, 684, 10, 1], "semantic": {"name": "self._xml_parser", "arg_names": [], "import_names": [], "rhs_call_name": "ParserCreate", "annotation": ""}, "snippet": " self._xml_parser = ParserCreate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L41_C4", "label": "self._xml_parser.StartElementHandler =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.3565, 0.0087, 2, 0.65, 0.3, 260, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.StartElementHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.StartElementHandler = self._StartElementHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L42_C4", "label": "self._xml_parser.EndElementHandler =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.3652, 0.0087, 2, 0.65, 0.4, 744, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.EndElementHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.EndElementHandler = self._EndElementHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L43_C4", "label": "self._xml_parser.CharacterDataHandler =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.3739, 0.0087, 2, 0.65, 0.5, 144, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.CharacterDataHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.CharacterDataHandler = self._CharacterDataHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L44_C4", "label": "self._xml_parser.CommentHandler =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.3826, 0.0087, 2, 0.65, 0.6, 403, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.CommentHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.CommentHandler = self._CommentHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L46_C4", "label": "file_obj = open()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [14, 2, 0.4, 0.0087, 2, 0.65, 0.7, 425, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "file_obj", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file_obj = open(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L47_C4", "label": "ParseFile()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [8, 2, 0.4087, 0.0087, 2, 0.65, 0.8, 341, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ParseFile", "arg_names": [], "import_names": [], "rhs_call_name": "ParseFile", "annotation": ""}, "snippet": " self._xml_parser.ParseFile(file_obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L48_C4", "label": "close()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [8, 2, 0.4174, 0.0087, 2, 0.65, 0.9, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file_obj.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "vector": [13, 2, 0.4348, 0.0087, 2, 0.65, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._all_strings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "label": "_Reset", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.4696, 0.0435, 1, 0.56, 0.2857, 412, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_Reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Reset(self):\n self._currentString = None\n self._currentStringName = None\n self._currentStringValue = None\n self._all_strings = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L53_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "vector": [14, 2, 0.4609, 0.0087, 2, 0.15, 0.0, 654, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L54_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "vector": [14, 2, 0.4696, 0.0087, 2, 0.15, 0.3333, 294, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L55_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "vector": [14, 2, 0.4783, 0.0087, 2, 0.15, 0.6667, 884, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L56_C4", "label": "self._all_strings =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "vector": [14, 2, 0.487, 0.0087, 2, 0.15, 1.0, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._all_strings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "label": "_StartElementHandler", "type": "function", "loc": [58, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.5783, 0.1565, 1, 0.56, 0.4286, 355, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "_StartElementHandler", "arg_names": ["self", "name", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _StartElementHandler(self, name, attrs):\n if name != 'string':\n return\n\n if 'name' not in attrs:\n return\n\n assert not self._currentString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [4, 2, 0.5174, 0.0174, 2, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L60_C6", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L59_C4", "vector": [13, 3, 0.5217, 0.0087, 3, 0.79, 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_60:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [4, 2, 0.5435, 0.0174, 2, 0.68, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'name' not in attrs:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L62_C4", "vector": [13, 3, 0.5478, 0.0087, 3, 0.0, 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_60:Assign_L67_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [14, 2, 0.5913, 0.0261, 2, 0.68, 0.4, 654, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = {\n 'startLine' : self._xml_parser.CurrentLineNumber,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [4, 2, 0.6217, 0.0174, 2, 0.68, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'rev' in attrs:\n self._currentString['revs'] = [attrs['rev']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L72_C6", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['revs'] = [attrs['rev']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L74_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [14, 2, 0.6435, 0.0087, 2, 0.68, 0.8, 294, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = attrs['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L75_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "vector": [14, 2, 0.6522, 0.0087, 2, 0.68, 1.0, 884, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "label": "_EndElementHandler", "type": "function", "loc": [77, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.7217, 0.113, 1, 0.56, 0.5714, 486, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_EndElementHandler", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _EndElementHandler(self, name):\n if name != 'string':\n return\n\n assert self._currentString\n assert self._currentStringName\n self._currentString['value'] = self._currentStringValue\n self._currentString['endLine'] = self._xml_parser.CurrentLineNumber"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [4, 2, 0.6826, 0.0174, 2, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L79_C6", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L78_C4", "vector": [13, 3, 0.687, 0.0087, 3, 0.27, 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_60:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7217, 0.0087, 2, 0.53, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['value'] = self._currentStringValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L84_C4", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7304, 0.0087, 2, 0.53, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['endLine'] = self._xml_parser.CurrentLineNumber"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L85_C4", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7391, 0.0087, 2, 0.53, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[self._currentStringName] = self._currentString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L87_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7565, 0.0087, 2, 0.53, 0.6667, 654, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L88_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7652, 0.0087, 2, 0.53, 0.8333, 294, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L89_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "vector": [14, 2, 0.7739, 0.0087, 2, 0.53, 1.0, 884, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L91_C2", "label": "_CharacterDataHandler", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.8087, 0.0435, 1, 0.56, 0.7143, 825, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_CharacterDataHandler", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CharacterDataHandler(self, data):\n if not self._currentString:\n return\n\n self._currentStringValue += data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L91_C2", "vector": [4, 2, 0.8043, 0.0174, 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 not self._currentString:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L92_C4", "vector": [13, 3, 0.8087, 0.0087, 3, 0.8, 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_60:Assign_L97_C2", "label": "_KEEP_PARENT_REGEX = compile()", "type": "assigned_variable", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [14, 1, 0.8565, 0.0348, 1, 0.56, 0.8571, 591, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "_KEEP_PARENT_REGEX", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " _KEEP_PARENT_REGEX = re.compile(r'\\s*KEEP_PARENT\\s+'\n r'name\\s*=\\s*[\\'\"]?(?P<name>[a-z0-9_]+)[\\'\"]?'\n r'(?:\\s+rev=[\\'\"]?(?P<rev>[0-9a-f]{12})[\\'\"]?)?\\s*',\n re.MULTILINE | re.DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "label": "_CommentHandler", "type": "function", "loc": [102, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "vector": [2, 1, 0.9435, 0.1217, 1, 0.56, 1.0, 562, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_CommentHandler", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CommentHandler(self, data):\n keep_parent_match = self._KEEP_PARENT_REGEX.match(data)\n if not keep_parent_match:\n return\n\n name = keep_parent_match.group('name')\n self._all_strings[name] = {\n 'keepParent' : True,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L103_C4", "label": "keep_parent_match = match()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [14, 2, 0.8957, 0.0087, 2, 0.17, 0.0, 885, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "keep_parent_match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " keep_parent_match = self._KEEP_PARENT_REGEX.match(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L104_C4", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [4, 2, 0.9087, 0.0174, 2, 0.17, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not keep_parent_match:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L104_C4", "vector": [13, 3, 0.913, 0.0087, 3, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L107_C4", "label": "name = group()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [14, 2, 0.9304, 0.0087, 2, 0.17, 0.4, 57, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " name = keep_parent_match.group('name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L108_C4", "label": "assign", "type": "assigned_variable", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [14, 2, 0.9565, 0.0435, 2, 0.17, 0.6, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[name] = {\n 'keepParent' : True,\n 'startLine' : self._xml_parser.CurrentLineNumber,\n 'endLine' : self._xml_parser.CurrentLineNumber\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L113_C4", "label": "rev = group()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [14, 2, 0.9826, 0.0087, 2, 0.17, 0.8, 337, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "rev", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " rev = keep_parent_match.group('rev')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:If_L114_C4", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "vector": [4, 2, 0.9957, 0.0174, 2, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev:\n self._all_strings[name]['revs'] = [rev]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L115_C6", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_60:If_L114_C4", "vector": [14, 3, 1.0, 0.0087, 3, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[name]['revs'] = [rev]"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_60:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_60:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_60:Assign_L115_C6"}]
import urllib import urllib2 import argparse import sys from log import Logger from datetime import datetime, timedelta def verify_order(postdata, sandbox): data = 'cmd=_notify-validate&' + postdata if sandbox: scr = 'https://www.sandbox.paypal.com/cgi-bin/websc' else: scr = 'https://www.paypal.com/cgi-bin/websc' res = urllib2.urlopen(scr, data).read() if res == 'VERIFIED': return True return False def convert_order(item): value = {} value['name'] = item['address_name'] value['mail'] = item['payer_email'] value['nickname'] = item['address_name'] gross = float(item['mc_gross']) fee = float(item['mc_fee']) value['amount'] = gross value['actual_amount'] = gross - fee value['unit'] = 'USD' value['comment'] = '' try: value['time'] = datetime.strptime( item['payment_date'], '%H:%M:%S %b %d, %Y PDT') + timedelta(hours = 15) except: value['time'] = datetime.strptime( item['payment_date'], '%H:%M:%S %b %d, %Y PST') + timedelta(hours = 16) value['method'] = 'paypal' value['id'] = item['txn_id'] return value def get_order(postdata): fields = postdata.split('&') item = {} for field in fields: name, value = field.split('=') value = urllib.unquote_plus(value) item[name] = value for field in item: item[field] = item[field].decode(item['charset']) return item def main(): parser = argparse.ArgumentParser() parser.add_argument('-l', '--log', dest='logfile', help='Logfile', required=True) parser.add_argument('-p', '--paypal', dest='paypal', help='Paypal input', required=True) args = parser.parse_args() item = get_order(args.paypal) if not verify_order(args.paypal, 'test_ipn' in item): print 'Error in verification' print args.paypal sys.exit(1) if item['payment_status'] != 'Completed': print 'Payment from ', item['address_name'], ' not completed ', item['txn_id'] print args.paypal sys.exit(1) logitem = convert_order(item) logfile = args.logfile if 'test_ipn' in item: logfile = 'test' logger = Logger({'logfile': logfile}) logger.log(logitem) logger.close() print (u'Received payment from %s, txn_id=%s, amount=$%.2f, date=%s' % ( logitem['name'], logitem['id'], logitem['amount'], item['payment_date'] )).encode('utf-8') if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_61
66
83
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_61:Import_L1_C0", "label": "urllib import urllib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 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_61:Import_L2_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0241, 0.012, 0, 0.66, 0.1, 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_61:Import_L3_C0", "label": "argparse import argparse", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0361, 0.012, 0, 0.66, 0.2, 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_61:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0482, 0.012, 0, 0.66, 0.3, 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_61:ImportFrom_L5_C0", "label": "from log import Logger", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0602, 0.012, 0, 0.66, 0.4, 432, 0, 1, 0, 0, 432, 0, 0], "semantic": {"name": "log", "arg_names": [], "import_names": ["Logger"], "rhs_call_name": "", "annotation": ""}, "snippet": "from log import Logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:ImportFrom_L6_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0723, 0.012, 0, 0.66, 0.5, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "label": "verify_order", "type": "function", "loc": [8, 17], "level": 0, "parent": null, "vector": [2, 0, 0.1506, 0.1205, 0, 0.66, 0.6, 236, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "verify_order", "arg_names": ["postdata", "sandbox"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def verify_order(postdata, sandbox):\n data = 'cmd=_notify-validate&' + postdata\n if sandbox:\n scr = 'https://www.sandbox.paypal.com/cgi-bin/websc'\n else:\n scr = 'https://www.paypal.com/cgi-bin/websc'\n res = urllib2.urlopen(scr, data).read()\n if res == 'VERIFIED':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L9_C2", "label": "data =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "vector": [14, 1, 0.1084, 0.012, 1, 0.09, 0.0, 929, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = 'cmd=_notify-validate&' + postdata"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2", "label": "if", "type": "if", "loc": [10, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "vector": [4, 1, 0.1386, 0.0482, 1, 0.09, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sandbox:\n scr = 'https://www.sandbox.paypal.com/cgi-bin/websc'\n else:\n scr = 'https://www.paypal.com/cgi-bin/websc'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L11_C4", "label": "scr =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2", "vector": [14, 2, 0.1325, 0.012, 2, 0.7, 0.0, 690, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scr = 'https://www.sandbox.paypal.com/cgi-bin/websc'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L13_C4", "label": "scr =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2", "vector": [14, 2, 0.1566, 0.012, 2, 0.7, 1.0, 690, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scr = 'https://www.paypal.com/cgi-bin/websc'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L14_C2", "label": "res = read()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "vector": [14, 1, 0.1687, 0.012, 1, 0.09, 0.5, 413, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " res = urllib2.urlopen(scr, data).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L15_C2", "label": "if", "type": "if", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "vector": [4, 1, 0.1867, 0.0241, 1, 0.09, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if res == 'VERIFIED':\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L15_C2", "vector": [13, 2, 0.1928, 0.012, 2, 0.14, 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_61:Return_L17_C2", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "vector": [13, 1, 0.2048, 0.012, 1, 0.09, 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_61:FunctionDef_L19_C0", "label": "convert_order", "type": "function", "loc": [19, 39], "level": 0, "parent": null, "vector": [2, 0, 0.3494, 0.253, 0, 0.66, 0.7, 542, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "convert_order", "arg_names": ["item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convert_order(item):\n value = {}\n value['name'] = item['address_name']\n value['mail'] = item['payer_email']\n value['nickname'] = item['address_name']\n gross = float(item['mc_gross'])\n fee = float(item['mc_fee'])\n value['amount'] = gross"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L20_C2", "label": "value =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.241, 0.012, 1, 0.44, 0.0, 441, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L21_C2", "label": "assign", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.253, 0.012, 1, 0.44, 0.0769, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['name'] = item['address_name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L22_C2", "label": "assign", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.2651, 0.012, 1, 0.44, 0.1538, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['mail'] = item['payer_email']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L23_C2", "label": "assign", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.2771, 0.012, 1, 0.44, 0.2308, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['nickname'] = item['address_name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L24_C2", "label": "gross = float()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.2892, 0.012, 1, 0.44, 0.3077, 972, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "gross", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " gross = float(item['mc_gross'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L25_C2", "label": "fee = float()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.3012, 0.012, 1, 0.44, 0.3846, 803, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "fee", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " fee = float(item['mc_fee'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L26_C2", "label": "assign", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.3133, 0.012, 1, 0.44, 0.4615, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['amount'] = gross"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L27_C2", "label": "assign", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.3253, 0.012, 1, 0.44, 0.5385, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['actual_amount'] = gross - fee"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L28_C2", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.3373, 0.012, 1, 0.44, 0.6154, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['unit'] = 'USD'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L29_C2", "label": "assign", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.3494, 0.012, 1, 0.44, 0.6923, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['comment'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2", "label": "try", "type": "try", "loc": [30, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [7, 1, 0.3916, 0.0723, 1, 0.44, 0.7692, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value['time'] = datetime.strptime(\n item['payment_date'], '%H:%M:%S %b %d, %Y PDT') + timedelta(hours = 15)\n except:\n value['time'] = datetime.strptime(\n item['payment_date'], '%H:%M:%S %b %d, %Y PST') + timedelta(hours = 16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L31_C4", "label": "assign", "type": "assigned_variable", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2", "vector": [14, 2, 0.3795, 0.0241, 2, 0.87, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['time'] = datetime.strptime(\n item['payment_date'], '%H:%M:%S %b %d, %Y PDT') + timedelta(hours = 15)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L34_C4", "label": "assign", "type": "assigned_variable", "loc": [34, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2", "vector": [14, 2, 0.4157, 0.0241, 2, 0.87, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['time'] = datetime.strptime(\n item['payment_date'], '%H:%M:%S %b %d, %Y PST') + timedelta(hours = 16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L37_C2", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.4458, 0.012, 1, 0.44, 0.8462, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['method'] = 'paypal'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L38_C2", "label": "assign", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [14, 1, 0.4578, 0.012, 1, 0.44, 0.9231, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value['id'] = item['txn_id']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L39_C2", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "vector": [13, 1, 0.4699, 0.012, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "label": "get_order", "type": "function", "loc": [42, 51], "level": 0, "parent": null, "vector": [2, 0, 0.5602, 0.1205, 0, 0.66, 0.8, 520, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_order", "arg_names": ["postdata"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_order(postdata):\n fields = postdata.split('&')\n item = {}\n for field in fields:\n name, value = field.split('=')\n value = urllib.unquote_plus(value)\n item[name] = value\n for field in item:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L43_C2", "label": "fields = split()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "vector": [14, 1, 0.5181, 0.012, 1, 0.27, 0.0, 358, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " fields = postdata.split('&')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L44_C2", "label": "item =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "vector": [14, 1, 0.5301, 0.012, 1, 0.27, 0.25, 434, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "label": "for field", "type": "for", "loc": [45, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "vector": [6, 1, 0.5602, 0.0482, 1, 0.27, 0.5, 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 name, value = field.split('=')\n value = urllib.unquote_plus(value)\n item[name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L46_C4", "label": "name, value = split()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "vector": [14, 2, 0.5542, 0.012, 2, 0.62, 0.0, 509, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "name, value", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " name, value = field.split('=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L47_C4", "label": "value = unquote_plus()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "vector": [14, 2, 0.5663, 0.012, 2, 0.62, 0.5, 441, 3, 1, 0, 0, 449, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "unquote_plus", "annotation": ""}, "snippet": " value = urllib.unquote_plus(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L48_C4", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "vector": [14, 2, 0.5783, 0.012, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item[name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:For_L49_C2", "label": "for field", "type": "for", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "vector": [6, 1, 0.5964, 0.0241, 1, 0.27, 0.75, 480, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in item:\n item[field] = item[field].decode(item['charset'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L50_C4", "label": " = decode()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:For_L49_C2", "vector": [14, 2, 0.6024, 0.012, 2, 0.47, 0.0, 0, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " item[field] = item[field].decode(item['charset'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "vector": [13, 1, 0.6145, 0.012, 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 item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "label": "main", "type": "function", "loc": [53, 80], "level": 0, "parent": null, "vector": [2, 0, 0.8012, 0.3373, 0, 0.66, 0.9, 624, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = argparse.ArgumentParser()\n parser.add_argument('-l', '--log', dest='logfile', help='Logfile',\n required=True)\n parser.add_argument('-p', '--paypal', dest='paypal', help='Paypal input',\n required=True)\n args = parser.parse_args()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L54_C2", "label": "parser = ArgumentParser()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.6506, 0.012, 1, 0.25, 0.0, 968, 3, 0, 0, 0, 570, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "ArgumentParser", "annotation": ""}, "snippet": " parser = argparse.ArgumentParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L55_C2", "label": "add_argument()", "type": "expression", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [8, 1, 0.6687, 0.0241, 1, 0.25, 0.0769, 178, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": " parser.add_argument('-l', '--log', dest='logfile', help='Logfile',\n required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L57_C2", "label": "add_argument()", "type": "expression", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [8, 1, 0.6928, 0.0241, 1, 0.25, 0.1538, 178, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": " parser.add_argument('-p', '--paypal', dest='paypal', help='Paypal input',\n required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L59_C2", "label": "args = parse_args()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.7108, 0.012, 1, 0.25, 0.2308, 805, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " args = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L61_C2", "label": "item = get_order()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.7349, 0.012, 1, 0.25, 0.3077, 434, 3, 1, 0, 0, 520, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "get_order", "annotation": ""}, "snippet": " item = get_order(args.paypal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [4, 1, 0.7651, 0.0482, 1, 0.25, 0.3846, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not verify_order(args.paypal, 'test_ipn' in item):\n print('Error in verification')\n print(args.paypal)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L63_C4", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "vector": [8, 2, 0.759, 0.012, 2, 0.68, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Error in verification')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L64_C4", "label": "print()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "vector": [8, 2, 0.7711, 0.012, 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": " print(args.paypal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L65_C4", "label": "exit()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "vector": [8, 2, 0.7831, 0.012, 2, 0.68, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "label": "if", "type": "if", "loc": [66, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [4, 1, 0.8133, 0.0482, 1, 0.25, 0.4615, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item['payment_status'] != 'Completed':\n print('Payment from ', item['address_name'], ' not completed ', item['txn_id'])\n print(args.paypal)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L67_C4", "label": "print()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "vector": [8, 2, 0.8072, 0.012, 2, 0.28, 0.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Payment from ', item['address_name'], ' not completed ', item['txn_id'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L68_C4", "label": "print()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "vector": [8, 2, 0.8193, 0.012, 2, 0.28, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(args.paypal)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L69_C4", "label": "exit()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "vector": [8, 2, 0.8313, 0.012, 2, 0.28, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L70_C2", "label": "logitem = convert_order()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.8434, 0.012, 1, 0.25, 0.5385, 805, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "logitem", "arg_names": [], "import_names": [], "rhs_call_name": "convert_order", "annotation": ""}, "snippet": " logitem = convert_order(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L72_C2", "label": "logfile =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.8675, 0.012, 1, 0.25, 0.6154, 554, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "logfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " logfile = args.logfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [4, 1, 0.8855, 0.0241, 1, 0.25, 0.6923, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'test_ipn' in item:\n logfile = 'test'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L74_C4", "label": "logfile =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L73_C2", "vector": [14, 2, 0.8916, 0.012, 2, 0.34, 0.0, 554, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "logfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " logfile = 'test'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L75_C2", "label": "logger = Logger()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [14, 1, 0.9036, 0.012, 1, 0.25, 0.7692, 532, 3, 1, 0, 0, 658, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "Logger", "annotation": ""}, "snippet": " logger = Logger({'logfile': logfile})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L76_C2", "label": "log()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [8, 1, 0.9157, 0.012, 1, 0.25, 0.8462, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " logger.log(logitem)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L77_C2", "label": "close()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [8, 1, 0.9277, 0.012, 1, 0.25, 0.9231, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " logger.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L78_C2", "label": "encode()", "type": "expression", "loc": [78, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "vector": [8, 1, 0.9518, 0.0361, 1, 0.25, 1.0, 623, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "encode", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " print (u'Received payment from %s, txn_id=%s, amount=$%.2f, date=%s' % (\n logitem['name'], logitem['id'], logitem['amount'], item['payment_date']\n )).encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_61:If_L82_C0", "label": "if", "type": "if", "loc": [82, 83], "level": 0, "parent": null, "vector": [4, 0, 0.994, 0.0241, 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_61:Expr_L83_C2", "label": "main()", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_61:If_L82_C0", "vector": [8, 1, 1.0, 0.012, 1, 0.14, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L10_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:If_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:Try_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:For_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:For_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:For_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Assign_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_61:If_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_61:Expr_L83_C2"}]
from hgapi import * import shutil import os import threading import optparse import traceback import log from datetime import datetime, timedelta class HGDonationLog: def __init__(self, config, logger): self._path = config['path'] self._repo = Repo(self._path) self._target = config['logfile'] self._templatefile = config['template'] self._update_interval = float(config.get('update_interval', 300)) self._logger = logger self.lastupdate = datetime.fromtimestamp(0) def start_listener(self): self.thread = threading.Thread(target = self.listener_thread) self.thread.start() def listener_thread(self): self.update_file() while True: sleep(self._update_interval) lastdataupdate = logger.lastupdate() if lastdataupdate > self.lastupdate: self.update_file() def gen_file(self, path): with open(path, 'w') as f: with open(self._templatefile, 'r') as tempfile: template = tempfile.read().decode('utf-8') usd, usdnofee, cny = self._logger.read_total() chinatime = (datetime.utcnow() + timedelta(hours = 8)) lastupdatestr = chinatime.strftime('%Y-%b-%d %X') + ' GMT+8' s = template.format(cny = cny, usd = usd, usdnofee = usdnofee, lastupdate = lastupdatestr) f.write(s.encode('utf-8')) records = self._logger.read_records() records.reverse() for item in records: t = item['time'].strftime('%b %d, %Y') item['datestr'] = t s = u'|| {nickname} || {amount:.2f} {unit} || {datestr} ||'.format(**item) print >>f, s.encode('utf-8') def update_file(self): try: self._repo.hg_command('pull') self._repo.hg_update(self._repo.hg_heads()[0]) path = os.path.join(self._path, self._target) print 'update donation log on wiki at ', datetime.utcnow() + timedelta(hours=8) self.gen_file(path) print 'File generated' msg = 'Auto update from script' diff = self._repo.hg_command('diff', self._target) if diff == '': print 'No change, skipping update donation wiki' return else: print diff.encode('utf-8') self._repo.hg_commit(msg, files = [self._target]) print 'change committed' self._repo.hg_command('push') print 'repo pushed to server' self.lastupdate = datetime.utcnow() + timedelta(hours = 8) except Exception as ex: print 'Update wiki failed: ', str(ex).encode('utf-8') traceback.print_exc() def main(): parser = optparse.OptionParser() parser.add_option('-w', '--wiki', dest='path', help='Your wiki repo') parser.add_option('-o', '--output', dest='logfile', help='Your logging file') parser.add_option('-t', '--template', dest='template', help='Your template file') parser.add_option('-l', '--logfile', dest='log', help='Log file') options, args = parser.parse_args() logger = log.Logger({'logfile': options.log}) print vars(options) hgclient = HGDonationLog(vars(options), logger) hgclient.update_file() if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_64
74
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_64:ImportFrom_L1_C0", "label": "from hgapi import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.011, 0.011, 0, 0.66, 0.0, 757, 0, 1, 0, 0, 757, 0, 0], "semantic": {"name": "hgapi", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hgapi import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Import_L2_C0", "label": "shutil import shutil", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.022, 0.011, 0, 0.66, 0.1, 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_64:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.033, 0.011, 0, 0.66, 0.2, 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_64:Import_L4_C0", "label": "threading import threading", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.044, 0.011, 0, 0.66, 0.3, 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_64:Import_L5_C0", "label": "optparse import optparse", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0549, 0.011, 0, 0.66, 0.4, 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_64:Import_L6_C0", "label": "traceback import traceback", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0659, 0.011, 0, 0.66, 0.5, 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_64:Import_L7_C0", "label": "log import log", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.011, 0, 0.66, 0.6, 432, 0, 1, 0, 0, 432, 0, 0], "semantic": {"name": "log", "arg_names": [], "import_names": ["log"], "rhs_call_name": "", "annotation": ""}, "snippet": "import log"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:ImportFrom_L8_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0879, 0.011, 0, 0.66, 0.7, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "label": "HGDonationLog", "type": "class", "loc": [10, 74], "level": 0, "parent": null, "vector": [3, 0, 0.4615, 0.7143, 0, 0.66, 0.8, 226, 0, 5, 0, 0, 0, 0, 48], "semantic": {"name": "HGDonationLog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HGDonationLog:\n def __init__(self, config, logger):\n self._path = config['path']\n self._repo = Repo(self._path)\n self._target = config['logfile']\n self._templatefile = config['template']\n self._update_interval = float(config.get('update_interval', 300))\n self._logger = logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "label": "__init__", "type": "function", "loc": [11, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "vector": [2, 1, 0.1593, 0.0879, 1, 0.56, 0.0, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "config", "logger"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, config, logger):\n self._path = config['path']\n self._repo = Repo(self._path)\n self._target = config['logfile']\n self._templatefile = config['template']\n self._update_interval = float(config.get('update_interval', 300))\n self._logger = logger\n self.lastupdate = datetime.fromtimestamp(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L12_C4", "label": "self._path =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1319, 0.011, 2, 0.27, 0.0, 249, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._path = config['path']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L13_C4", "label": "self._repo = Repo()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1429, 0.011, 2, 0.27, 0.1667, 439, 3, 1, 0, 0, 513, 10, 1], "semantic": {"name": "self._repo", "arg_names": [], "import_names": [], "rhs_call_name": "Repo", "annotation": ""}, "snippet": " self._repo = Repo(self._path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L14_C4", "label": "self._target =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1538, 0.011, 2, 0.27, 0.3333, 861, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._target = config['logfile']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L15_C4", "label": "self._templatefile =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1648, 0.011, 2, 0.27, 0.5, 90, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._templatefile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._templatefile = config['template']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L16_C4", "label": "self._update_interval = float()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1758, 0.011, 2, 0.27, 0.6667, 101, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "self._update_interval", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " self._update_interval = float(config.get('update_interval', 300))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L17_C4", "label": "self._logger =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1868, 0.011, 2, 0.27, 0.8333, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._logger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._logger = logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L18_C4", "label": "self.lastupdate = fromtimestamp()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "vector": [14, 2, 0.1978, 0.011, 2, 0.27, 1.0, 685, 3, 1, 0, 0, 48, 10, 1], "semantic": {"name": "self.lastupdate", "arg_names": [], "import_names": [], "rhs_call_name": "fromtimestamp", "annotation": ""}, "snippet": " self.lastupdate = datetime.fromtimestamp(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2", "label": "start_listener", "type": "function", "loc": [20, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "vector": [2, 1, 0.2308, 0.033, 1, 0.56, 0.25, 589, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "start_listener", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start_listener(self):\n self.thread = threading.Thread(target = self.listener_thread)\n self.thread.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L21_C4", "label": "self.thread = Thread()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2", "vector": [14, 2, 0.2308, 0.011, 2, 0.71, 0.0, 2, 3, 1, 0, 0, 134, 10, 1], "semantic": {"name": "self.thread", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " self.thread = threading.Thread(target = self.listener_thread)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L22_C4", "label": "start()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2", "vector": [8, 2, 0.2418, 0.011, 2, 0.71, 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_64:FunctionDef_L24_C2", "label": "listener_thread", "type": "function", "loc": [24, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "vector": [2, 1, 0.2967, 0.0769, 1, 0.56, 0.5, 718, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "listener_thread", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def listener_thread(self):\n self.update_file()\n while True:\n sleep(self._update_interval)\n lastdataupdate = logger.lastupdate()\n if lastdataupdate > self.lastupdate:\n self.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L25_C4", "label": "update_file()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L24_C2", "vector": [8, 2, 0.2747, 0.011, 2, 0.89, 0.0, 157, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_file", "arg_names": [], "import_names": [], "rhs_call_name": "update_file", "annotation": ""}, "snippet": " self.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "label": "while", "type": "while", "loc": [26, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L24_C2", "vector": [5, 2, 0.3077, 0.0549, 2, 0.89, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n sleep(self._update_interval)\n lastdataupdate = logger.lastupdate()\n if lastdataupdate > self.lastupdate:\n self.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L27_C6", "label": "sleep()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "vector": [8, 3, 0.2967, 0.011, 3, 0.32, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " sleep(self._update_interval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L28_C6", "label": "lastdataupdate = lastupdate()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "vector": [14, 3, 0.3077, 0.011, 3, 0.32, 0.5, 44, 3, 0, 0, 0, 705, 10, 1], "semantic": {"name": "lastdataupdate", "arg_names": [], "import_names": [], "rhs_call_name": "lastupdate", "annotation": ""}, "snippet": " lastdataupdate = logger.lastupdate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:If_L29_C6", "label": "if", "type": "if", "loc": [29, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "vector": [4, 3, 0.3242, 0.022, 3, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lastdataupdate > self.lastupdate:\n self.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L30_C8", "label": "update_file()", "type": "expression", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:If_L29_C6", "vector": [8, 4, 0.3297, 0.011, 4, 0.44, 0.0, 157, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_file", "arg_names": [], "import_names": [], "rhs_call_name": "update_file", "annotation": ""}, "snippet": " self.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "label": "gen_file", "type": "function", "loc": [32, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "vector": [2, 1, 0.4451, 0.1978, 1, 0.56, 0.75, 358, 0, 2, 0, 0, 0, 0, 15], "semantic": {"name": "gen_file", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gen_file(self, path):\n with open(path, 'w') as f:\n with open(self._templatefile, 'r') as tempfile:\n template = tempfile.read().decode('utf-8')\n\n usd, usdnofee, cny = self._logger.read_total()\n chinatime = (datetime.utcnow() + timedelta(hours = 8))\n lastupdatestr = chinatime.strftime('%Y-%b-%d %X') + ' GMT+8'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L35_C8", "label": "template = decode()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.3846, 0.011, 2, 0.31, 0.0, 549, 3, 1, 0, 0, 528, 10, 2], "semantic": {"name": "template", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " template = tempfile.read().decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L37_C6", "label": "usd, usdnofee, cny = read_total()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.4066, 0.011, 2, 0.31, 0.0, 574, 3, 0, 0, 0, 126, 10, 1], "semantic": {"name": "usd, usdnofee, cny", "arg_names": [], "import_names": [], "rhs_call_name": "read_total", "annotation": ""}, "snippet": " usd, usdnofee, cny = self._logger.read_total()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L38_C6", "label": "chinatime =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.4176, 0.011, 2, 0.31, 0.1429, 741, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "chinatime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chinatime = (datetime.utcnow() + timedelta(hours = 8))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L39_C6", "label": "lastupdatestr =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.4286, 0.011, 2, 0.31, 0.2857, 362, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "lastupdatestr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lastupdatestr = chinatime.strftime('%Y-%b-%d %X') + ' GMT+8'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L41_C6", "label": "s = format()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.4505, 0.011, 2, 0.31, 0.4286, 553, 3, 4, 0, 0, 293, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " s = template.format(cny = cny, usd = usd, usdnofee = usdnofee, lastupdate = lastupdatestr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L42_C6", "label": "write()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [8, 2, 0.4615, 0.011, 2, 0.31, 0.5714, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(s.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L44_C6", "label": "records = read_records()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [14, 2, 0.4835, 0.011, 2, 0.31, 0.7143, 186, 3, 0, 0, 0, 590, 10, 1], "semantic": {"name": "records", "arg_names": [], "import_names": [], "rhs_call_name": "read_records", "annotation": ""}, "snippet": " records = self._logger.read_records()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L45_C6", "label": "reverse()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [8, 2, 0.4945, 0.011, 2, 0.31, 0.8571, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " records.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "label": "for item", "type": "for", "loc": [46, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "vector": [6, 2, 0.522, 0.044, 2, 0.31, 1.0, 434, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in records:\n t = item['time'].strftime('%b %d, %Y')\n item['datestr'] = t\n s = u'|| {nickname} || {amount:.2f} {unit} || {datestr} ||'.format(**item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L47_C8", "label": "t = strftime()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "vector": [14, 3, 0.5165, 0.011, 3, 0.58, 0.0, 15, 3, 1, 0, 0, 668, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "strftime", "annotation": ""}, "snippet": " t = item['time'].strftime('%b %d, %Y')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L48_C8", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "vector": [14, 3, 0.5275, 0.011, 3, 0.58, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item['datestr'] = t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L49_C8", "label": "s = format()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "vector": [14, 3, 0.5385, 0.011, 3, 0.58, 1.0, 553, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " s = u'|| {nickname} || {amount:.2f} {unit} || {datestr} ||'.format(**item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L51_C2", "label": "update_file", "type": "function", "loc": [51, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "vector": [2, 1, 0.6868, 0.2637, 1, 0.56, 1.0, 157, 0, 1, 0, 0, 0, 0, 23], "semantic": {"name": "update_file", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_file(self):\n try:\n self._repo.hg_command('pull')\n self._repo.hg_update(self._repo.hg_heads()[0])\n\n path = os.path.join(self._path, self._target)\n print('update donation log on wiki at ', datetime.utcnow() + timedelta(hours=8))\n self.gen_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "label": "try", "type": "try", "loc": [52, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L51_C2", "vector": [7, 2, 0.6923, 0.2527, 2, 0.8, 0.0, 0, 0, 1, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self._repo.hg_command('pull')\n self._repo.hg_update(self._repo.hg_heads()[0])\n\n path = os.path.join(self._path, self._target)\n print('update donation log on wiki at ', datetime.utcnow() + timedelta(hours=8))\n self.gen_file(path)\n print('File generated')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L53_C6", "label": "hg_command()", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.5824, 0.011, 3, 0.09, 0.0, 600, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hg_command", "arg_names": [], "import_names": [], "rhs_call_name": "hg_command", "annotation": ""}, "snippet": " self._repo.hg_command('pull')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L54_C6", "label": "hg_update()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.5934, 0.011, 3, 0.09, 0.0769, 977, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "hg_update", "arg_names": [], "import_names": [], "rhs_call_name": "hg_update", "annotation": ""}, "snippet": " self._repo.hg_update(self._repo.hg_heads()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L56_C6", "label": "path = join()", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [14, 3, 0.6154, 0.011, 3, 0.09, 0.1538, 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(self._path, self._target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L57_C6", "label": "print()", "type": "expression", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.6264, 0.011, 3, 0.09, 0.2308, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('update donation log on wiki at ', datetime.utcnow() + timedelta(hours=8))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L58_C6", "label": "gen_file()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.6374, 0.011, 3, 0.09, 0.3077, 358, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "gen_file", "arg_names": [], "import_names": [], "rhs_call_name": "gen_file", "annotation": ""}, "snippet": " self.gen_file(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L59_C6", "label": "print()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.6484, 0.011, 3, 0.09, 0.3846, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File generated')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L60_C6", "label": "msg =", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [14, 3, 0.6593, 0.011, 3, 0.09, 0.4615, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Auto update from script'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L61_C6", "label": "diff = hg_command()", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [14, 3, 0.6703, 0.011, 3, 0.09, 0.5385, 833, 3, 2, 0, 0, 600, 10, 1], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "hg_command", "annotation": ""}, "snippet": " diff = self._repo.hg_command('diff', self._target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "label": "if", "type": "if", "loc": [62, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [4, 3, 0.7033, 0.0549, 3, 0.09, 0.6154, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if diff == '':\n print('No change, skipping update donation wiki')\n return\n else:\n print(diff.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L63_C8", "label": "print()", "type": "expression", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "vector": [8, 4, 0.6923, 0.011, 4, 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('No change, skipping update donation wiki')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Return_L64_C8", "label": "return", "type": "return", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "vector": [13, 4, 0.7033, 0.011, 4, 0.48, 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_64:Expr_L66_C8", "label": "print()", "type": "expression", "loc": [66, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "vector": [8, 4, 0.7253, 0.011, 4, 0.48, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(diff.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L67_C6", "label": "hg_commit()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.7363, 0.011, 3, 0.09, 0.6923, 79, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "hg_commit", "arg_names": [], "import_names": [], "rhs_call_name": "hg_commit", "annotation": ""}, "snippet": " self._repo.hg_commit(msg, files = [self._target])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L68_C6", "label": "print()", "type": "expression", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.7473, 0.011, 3, 0.09, 0.7692, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('change committed')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L69_C6", "label": "hg_command()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.7582, 0.011, 3, 0.09, 0.8462, 600, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "hg_command", "arg_names": [], "import_names": [], "rhs_call_name": "hg_command", "annotation": ""}, "snippet": " self._repo.hg_command('push')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L70_C6", "label": "print()", "type": "expression", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.7692, 0.011, 3, 0.09, 0.9231, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('repo pushed to server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L71_C6", "label": "self.lastupdate =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [14, 3, 0.7802, 0.011, 3, 0.09, 1.0, 685, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.lastupdate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lastupdate = datetime.utcnow() + timedelta(hours = 8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L73_C6", "label": "print()", "type": "expression", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.8022, 0.011, 3, 0.09, 0.0, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Update wiki failed: ', str(ex).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L74_C6", "label": "print_exc()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "vector": [8, 3, 0.8132, 0.011, 3, 0.09, 1.0, 234, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_exc", "arg_names": [], "import_names": [], "rhs_call_name": "print_exc", "annotation": ""}, "snippet": " traceback.print_exc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "label": "main", "type": "function", "loc": [76, 88], "level": 0, "parent": null, "vector": [2, 0, 0.9011, 0.1429, 0, 0.66, 0.9, 624, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser()\n parser.add_option('-w', '--wiki', dest='path', help='Your wiki repo')\n parser.add_option('-o', '--output', dest='logfile', help='Your logging file')\n parser.add_option('-t', '--template', dest='template',\n help='Your template file')\n parser.add_option('-l', '--logfile', dest='log', help='Log file')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L77_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [14, 1, 0.8462, 0.011, 1, 0.46, 0.0, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L78_C2", "label": "add_option()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.8571, 0.011, 1, 0.46, 0.1111, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-w', '--wiki', dest='path', help='Your wiki repo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L79_C2", "label": "add_option()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.8681, 0.011, 1, 0.46, 0.2222, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-o', '--output', dest='logfile', help='Your logging file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L80_C2", "label": "add_option()", "type": "expression", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.8846, 0.022, 1, 0.46, 0.3333, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-t', '--template', dest='template',\n help='Your template file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L82_C2", "label": "add_option()", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.9011, 0.011, 1, 0.46, 0.4444, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-l', '--logfile', dest='log', help='Log file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L84_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [14, 1, 0.9231, 0.011, 1, 0.46, 0.5556, 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_64:Assign_L85_C2", "label": "logger = Logger()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [14, 1, 0.9341, 0.011, 1, 0.46, 0.6667, 532, 3, 1, 0, 0, 658, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "Logger", "annotation": ""}, "snippet": " logger = log.Logger({'logfile': options.log})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L86_C2", "label": "print()", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.9451, 0.011, 1, 0.46, 0.7778, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(vars(options))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L87_C2", "label": "hgclient = HGDonationLog()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [14, 1, 0.956, 0.011, 1, 0.46, 0.8889, 211, 3, 2, 0, 0, 226, 10, 2], "semantic": {"name": "hgclient", "arg_names": [], "import_names": [], "rhs_call_name": "HGDonationLog", "annotation": ""}, "snippet": " hgclient = HGDonationLog(vars(options), logger)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L88_C2", "label": "update_file()", "type": "expression", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "vector": [8, 1, 0.967, 0.011, 1, 0.46, 1.0, 157, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_file", "arg_names": [], "import_names": [], "rhs_call_name": "update_file", "annotation": ""}, "snippet": " hgclient.update_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:If_L90_C0", "label": "if", "type": "if", "loc": [90, 91], "level": 0, "parent": null, "vector": [4, 0, 0.9945, 0.022, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L91_C2", "label": "main()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_64:If_L90_C0", "vector": [8, 1, 1.0, 0.011, 1, 0.63, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L11_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L24_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:While_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:If_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:If_L29_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L37_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L38_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L41_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L44_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L45_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:For_L46_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Return_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:If_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L68_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L69_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L70_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L71_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:Try_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:FunctionDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_64:If_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_64:Expr_L91_C2"}]
import subprocess import tempfile import shutil import os import codecs import json import zipfile class Packer: def __init__(self, input_path, outputfile): self.input_path = os.path.abspath(input_path) self.outputfile = os.path.abspath(outputfile) self.tmppath = None def pack(self): if self.tmppath == None: self.tmppath = tempfile.mkdtemp() else: self.tmppath = os.path.abspath(self.tmppath) if not os.path.isdir(self.tmppath): os.mkdir(self.tmppath) self.zipf = zipfile.ZipFile(self.outputfile, 'w', zipfile.ZIP_DEFLATED) self.processdir('') self.zipf.close() def processdir(self, path): dst = os.path.join(self.tmppath, path) if not os.path.isdir(dst): os.mkdir(dst) for f in os.listdir(os.path.join(self.input_path, path)): abspath = os.path.join(self.input_path, path, f) if os.path.isdir(abspath): self.processdir(os.path.join(path, f)) else: self.processfile(os.path.join(path, f)) def compact_json(self, src, dst): print 'Compacting json file ', src with open(src) as s: sval = s.read() if sval[:3] == codecs.BOM_UTF8: sval = sval[3:].decode('utf-8') val = json.loads(sval, 'utf-8') with open(dst, 'w') as d: json.dump(val, d, separators=(',', ':')) def processfile(self, path): src = os.path.join(self.input_path, path) dst = os.path.join(self.tmppath, path) if not os.path.isfile(dst) or os.stat(src).st_mtime > os.stat(dst).st_mtime: ext = os.path.splitext(path)[1].lower() op = None if ext == '.js': if path.split(os.sep)[0] == 'settings': op = self.copyfile elif os.path.basename(path) == 'jquery.js': op = self.copyfile else: op = self.compilefile elif ext == '.json': op = self.compact_json elif ext in ['.swp', '.php']: pass else: op = self.copyfile if op != None: op(src, dst) if os.path.isfile(dst): self.zipf.write(dst, path) def copyfile(self, src, dst): shutil.copyfile(src, dst) def compilefile(self, src, dst): args = ['java', '-jar', 'compiler.jar',\ '--js', src, '--js_output_file', dst] args += ['--language_in', 'ECMASCRIPT5'] print 'Compiling ', src retval = subprocess.call(args) if retval != 0: os.remove(dst) print 'Failed to generate ', dst a = Packer('..\\chrome', '..\\plugin.zip') a.tmppath = '..\\output' a.pack()
ajibawa-2023/Python-Code-Large/train/row_65
69
86
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_65:Import_L1_C0", "label": "subprocess import subprocess", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Import_L2_C0", "label": "tempfile import tempfile", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0116, 0, 0.66, 0.1, 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_65:Import_L3_C0", "label": "shutil import shutil", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0349, 0.0116, 0, 0.66, 0.2, 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_65:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0465, 0.0116, 0, 0.66, 0.3, 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_65:Import_L5_C0", "label": "codecs import codecs", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0581, 0.0116, 0, 0.66, 0.4, 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_65:Import_L6_C0", "label": "json import json", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0698, 0.0116, 0, 0.66, 0.5, 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_65:Import_L7_C0", "label": "zipfile import zipfile", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0814, 0.0116, 0, 0.66, 0.6, 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_65:ClassDef_L9_C0", "label": "Packer", "type": "class", "loc": [9, 82], "level": 0, "parent": null, "vector": [3, 0, 0.5291, 0.8605, 0, 0.66, 0.7, 593, 0, 7, 0, 0, 0, 0, 44], "semantic": {"name": "Packer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Packer:\n def __init__(self, input_path, outputfile):\n self.input_path = os.path.abspath(input_path)\n self.outputfile = os.path.abspath(outputfile)\n self.tmppath = None\n\n def pack(self):\n if self.tmppath == None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "label": "__init__", "type": "function", "loc": [10, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.1337, 0.0465, 1, 0.9, 0.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "input_path", "outputfile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, input_path, outputfile):\n self.input_path = os.path.abspath(input_path)\n self.outputfile = os.path.abspath(outputfile)\n self.tmppath = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L11_C4", "label": "self.input_path = abspath()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "vector": [14, 2, 0.1279, 0.0116, 2, 0.42, 0.0, 873, 3, 1, 0, 0, 142, 10, 1], "semantic": {"name": "self.input_path", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " self.input_path = os.path.abspath(input_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L12_C4", "label": "self.outputfile = abspath()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "vector": [14, 2, 0.1395, 0.0116, 2, 0.42, 0.5, 653, 3, 1, 0, 0, 142, 10, 1], "semantic": {"name": "self.outputfile", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " self.outputfile = os.path.abspath(outputfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L13_C4", "label": "self.tmppath =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "vector": [14, 2, 0.1512, 0.0116, 2, 0.42, 1.0, 989, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.tmppath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tmppath = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "label": "pack", "type": "function", "loc": [15, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.2267, 0.1163, 1, 0.9, 0.1667, 742, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "pack", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pack(self):\n if self.tmppath == None:\n self.tmppath = tempfile.mkdtemp()\n else:\n self.tmppath = os.path.abspath(self.tmppath)\n if not os.path.isdir(self.tmppath):\n os.mkdir(self.tmppath)\n self.zipf = zipfile.ZipFile(self.outputfile, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "label": "if", "type": "if", "loc": [16, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "vector": [4, 2, 0.2151, 0.0698, 2, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.tmppath == None:\n self.tmppath = tempfile.mkdtemp()\n else:\n self.tmppath = os.path.abspath(self.tmppath)\n if not os.path.isdir(self.tmppath):\n os.mkdir(self.tmppath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L17_C6", "label": "self.tmppath = mkdtemp()", "type": "assigned_variable", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "vector": [14, 3, 0.1977, 0.0116, 3, 0.95, 0.0, 989, 3, 0, 0, 0, 912, 10, 1], "semantic": {"name": "self.tmppath", "arg_names": [], "import_names": [], "rhs_call_name": "mkdtemp", "annotation": ""}, "snippet": " self.tmppath = tempfile.mkdtemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L19_C6", "label": "self.tmppath = abspath()", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "vector": [14, 3, 0.2209, 0.0116, 3, 0.95, 0.5, 989, 3, 1, 0, 0, 142, 10, 1], "semantic": {"name": "self.tmppath", "arg_names": [], "import_names": [], "rhs_call_name": "abspath", "annotation": ""}, "snippet": " self.tmppath = os.path.abspath(self.tmppath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L20_C6", "label": "if", "type": "if", "loc": [20, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "vector": [4, 3, 0.2384, 0.0233, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isdir(self.tmppath):\n os.mkdir(self.tmppath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L21_C8", "label": "mkdir()", "type": "expression", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L20_C6", "vector": [8, 4, 0.2442, 0.0116, 4, 0.47, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(self.tmppath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L22_C4", "label": "self.zipf = ZipFile()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "vector": [14, 2, 0.2558, 0.0116, 2, 0.15, 0.3333, 192, 3, 3, 0, 0, 299, 10, 1], "semantic": {"name": "self.zipf", "arg_names": [], "import_names": [], "rhs_call_name": "ZipFile", "annotation": ""}, "snippet": " self.zipf = zipfile.ZipFile(self.outputfile, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L23_C4", "label": "processdir()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "vector": [8, 2, 0.2674, 0.0116, 2, 0.15, 0.6667, 654, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "processdir", "arg_names": [], "import_names": [], "rhs_call_name": "processdir", "annotation": ""}, "snippet": " self.processdir('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L24_C4", "label": "close()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "vector": [8, 2, 0.2791, 0.0116, 2, 0.15, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.zipf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "label": "processdir", "type": "function", "loc": [26, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.3547, 0.1163, 1, 0.9, 0.3333, 654, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "processdir", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def processdir(self, path):\n dst = os.path.join(self.tmppath, path)\n if not os.path.isdir(dst):\n os.mkdir(dst)\n for f in os.listdir(os.path.join(self.input_path, path)):\n abspath = os.path.join(self.input_path, path, f)\n if os.path.isdir(abspath):\n self.processdir(os.path.join(path, f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L27_C4", "label": "dst = join()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "vector": [14, 2, 0.314, 0.0116, 2, 0.13, 0.0, 856, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " dst = os.path.join(self.tmppath, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L28_C4", "label": "if", "type": "if", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "vector": [4, 2, 0.3314, 0.0233, 2, 0.13, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isdir(dst):\n os.mkdir(dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L29_C6", "label": "mkdir()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L28_C4", "vector": [8, 3, 0.3372, 0.0116, 3, 0.36, 0.0, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4", "label": "for f", "type": "for", "loc": [30, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "vector": [6, 2, 0.3779, 0.0698, 2, 0.13, 1.0, 899, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in os.listdir(os.path.join(self.input_path, path)):\n abspath = os.path.join(self.input_path, path, f)\n if os.path.isdir(abspath):\n self.processdir(os.path.join(path, f))\n else:\n self.processfile(os.path.join(path, f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L31_C6", "label": "abspath = join()", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4", "vector": [14, 3, 0.3605, 0.0116, 3, 0.03, 0.0, 142, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "abspath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " abspath = os.path.join(self.input_path, path, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6", "label": "if", "type": "if", "loc": [32, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4", "vector": [4, 3, 0.3895, 0.0465, 3, 0.03, 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(abspath):\n self.processdir(os.path.join(path, f))\n else:\n self.processfile(os.path.join(path, f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L33_C8", "label": "processdir()", "type": "expression", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6", "vector": [8, 4, 0.3837, 0.0116, 4, 0.74, 0.0, 654, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "processdir", "arg_names": [], "import_names": [], "rhs_call_name": "processdir", "annotation": ""}, "snippet": " self.processdir(os.path.join(path, f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L35_C8", "label": "processfile()", "type": "expression", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6", "vector": [8, 4, 0.407, 0.0116, 4, 0.74, 1.0, 878, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "processfile", "arg_names": [], "import_names": [], "rhs_call_name": "processfile", "annotation": ""}, "snippet": " self.processfile(os.path.join(path, f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "label": "compact_json", "type": "function", "loc": [37, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.4767, 0.1047, 1, 0.9, 0.5, 604, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "compact_json", "arg_names": ["self", "src", "dst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def compact_json(self, src, dst):\n print('Compacting json file ', src)\n with open(src) as s:\n sval = s.read()\n if sval[:3] == codecs.BOM_UTF8:\n sval = sval[3:].decode('utf-8')\n val = json.loads(sval, 'utf-8')\n with open(dst, 'w') as d:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L38_C4", "label": "print()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "vector": [8, 2, 0.4419, 0.0116, 2, 0.71, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Compacting json file ', src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L40_C6", "label": "sval = read()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "vector": [14, 2, 0.4651, 0.0116, 2, 0.71, 0.0, 81, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "sval", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " sval = s.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "vector": [4, 2, 0.4826, 0.0233, 2, 0.71, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sval[:3] == codecs.BOM_UTF8:\n sval = sval[3:].decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L42_C6", "label": "sval = decode()", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L41_C4", "vector": [14, 3, 0.4884, 0.0116, 3, 0.79, 0.0, 81, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "sval", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " sval = sval[3:].decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L43_C4", "label": "val = loads()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "vector": [14, 2, 0.5, 0.0116, 2, 0.71, 1.0, 618, 3, 2, 0, 0, 88, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " val = json.loads(sval, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L45_C6", "label": "dump()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "vector": [8, 2, 0.5233, 0.0116, 2, 0.71, 0.0, 952, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " json.dump(val, d, separators=(',', ':'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "label": "processfile", "type": "function", "loc": [47, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.6744, 0.2674, 1, 0.9, 0.6667, 878, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "processfile", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def processfile(self, path):\n src = os.path.join(self.input_path, path)\n dst = os.path.join(self.tmppath, path)\n if not os.path.isfile(dst) or os.stat(src).st_mtime > os.stat(dst).st_mtime:\n ext = os.path.splitext(path)[1].lower()\n op = None\n if ext == '.js':\n if path.split(os.sep)[0] == 'settings':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L48_C4", "label": "src = join()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "vector": [14, 2, 0.5581, 0.0116, 2, 0.75, 0.0, 345, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " src = os.path.join(self.input_path, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L49_C4", "label": "dst = join()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "vector": [14, 2, 0.5698, 0.0116, 2, 0.75, 0.3333, 856, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " dst = os.path.join(self.tmppath, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "label": "if", "type": "if", "loc": [50, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "vector": [4, 2, 0.6802, 0.2093, 2, 0.75, 0.6667, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isfile(dst) or os.stat(src).st_mtime > os.stat(dst).st_mtime:\n ext = os.path.splitext(path)[1].lower()\n op = None\n if ext == '.js':\n if path.split(os.sep)[0] == 'settings':\n op = self.copyfile\n elif os.path.basename(path) == 'jquery.js':\n op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L51_C6", "label": "ext = lower()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "vector": [14, 3, 0.593, 0.0116, 3, 0.01, 0.0, 916, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "ext", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " ext = os.path.splitext(path)[1].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L52_C6", "label": "op =", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "vector": [14, 3, 0.6047, 0.0116, 3, 0.01, 0.3333, 316, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6", "label": "if", "type": "if", "loc": [53, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "vector": [4, 3, 0.686, 0.1512, 3, 0.01, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ext == '.js':\n if path.split(os.sep)[0] == 'settings':\n op = self.copyfile\n elif os.path.basename(path) == 'jquery.js':\n op = self.copyfile\n else:\n op = self.compilefile\n elif ext == '.json':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8", "label": "if", "type": "if", "loc": [54, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6", "vector": [4, 4, 0.657, 0.0698, 4, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path.split(os.sep)[0] == 'settings':\n op = self.copyfile\n elif os.path.basename(path) == 'jquery.js':\n op = self.copyfile\n else:\n op = self.compilefile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L55_C10", "label": "op =", "type": "assigned_variable", "loc": [55, 55], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8", "vector": [14, 5, 0.6395, 0.0116, 5, 0.38, 0.0, 316, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8", "label": "if", "type": "if", "loc": [56, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8", "vector": [4, 5, 0.6686, 0.0465, 5, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif os.path.basename(path) == 'jquery.js':\n op = self.copyfile\n else:\n op = self.compilefile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L57_C10", "label": "op =", "type": "assigned_variable", "loc": [57, 57], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8", "vector": [14, 6, 0.6628, 0.0116, 6, 0.89, 0.0, 316, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L59_C10", "label": "op =", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8", "vector": [14, 6, 0.686, 0.0116, 6, 0.89, 1.0, 316, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.compilefile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6", "label": "if", "type": "if", "loc": [60, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6", "vector": [4, 4, 0.7267, 0.0698, 4, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ext == '.json':\n op = self.compact_json\n elif ext in ['.swp', '.php']:\n pass\n else:\n op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L61_C8", "label": "op =", "type": "assigned_variable", "loc": [61, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6", "vector": [14, 5, 0.7093, 0.0116, 5, 0.27, 0.0, 316, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.compact_json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L62_C6", "label": "if", "type": "if", "loc": [62, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6", "vector": [4, 5, 0.7384, 0.0465, 5, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ext in ['.swp', '.php']:\n pass\n else:\n op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L65_C8", "label": "op =", "type": "assigned_variable", "loc": [65, 65], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L62_C6", "vector": [14, 6, 0.7558, 0.0116, 6, 0.9, 0.0, 316, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " op = self.copyfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L66_C6", "label": "if", "type": "if", "loc": [66, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "vector": [4, 3, 0.7733, 0.0233, 3, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if op != None:\n op(src, dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L67_C8", "label": "op()", "type": "expression", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L66_C6", "vector": [8, 4, 0.7791, 0.0116, 4, 0.18, 0.0, 316, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "op", "annotation": ""}, "snippet": " op(src, dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L68_C4", "label": "if", "type": "if", "loc": [68, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "vector": [4, 2, 0.7965, 0.0233, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(dst):\n self.zipf.write(dst, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L69_C6", "label": "write()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L68_C4", "vector": [8, 3, 0.8023, 0.0116, 3, 0.97, 0.0, 837, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.zipf.write(dst, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L71_C2", "label": "copyfile", "type": "function", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.8314, 0.0233, 1, 0.9, 0.8333, 918, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "copyfile", "arg_names": ["self", "src", "dst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def copyfile(self, src, dst):\n shutil.copyfile(src, dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L72_C4", "label": "copyfile()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L71_C2", "vector": [8, 2, 0.8372, 0.0116, 2, 0.71, 0.0, 918, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copyfile", "arg_names": [], "import_names": [], "rhs_call_name": "copyfile", "annotation": ""}, "snippet": " shutil.copyfile(src, dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "label": "compilefile", "type": "function", "loc": [74, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "vector": [2, 1, 0.907, 0.1047, 1, 0.9, 1.0, 744, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "compilefile", "arg_names": ["self", "src", "dst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def compilefile(self, src, dst):\n args = ['java', '-jar', 'compiler.jar',\\\n '--js', src, '--js_output_file', dst]\n args += ['--language_in', 'ECMASCRIPT5']\n print('Compiling ', src)\n retval = subprocess.call(args)\n if retval != 0:\n os.remove(dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L75_C4", "label": "args =", "type": "assigned_variable", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "vector": [14, 2, 0.8779, 0.0233, 2, 0.9, 0.0, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = ['java', '-jar', 'compiler.jar',\\\n '--js', src, '--js_output_file', dst]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L78_C4", "label": "print()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "vector": [8, 2, 0.907, 0.0116, 2, 0.9, 0.3333, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Compiling ', src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L79_C4", "label": "retval = call()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "vector": [14, 2, 0.9186, 0.0116, 2, 0.9, 0.6667, 991, 3, 1, 0, 0, 832, 10, 1], "semantic": {"name": "retval", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " retval = subprocess.call(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4", "label": "if", "type": "if", "loc": [80, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "vector": [4, 2, 0.9419, 0.0349, 2, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if retval != 0:\n os.remove(dst)\n print('Failed to generate ', dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L81_C6", "label": "remove()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4", "vector": [8, 3, 0.9419, 0.0116, 3, 0.79, 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(dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L82_C6", "label": "print()", "type": "expression", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4", "vector": [8, 3, 0.9535, 0.0116, 3, 0.79, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Failed to generate ', dst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L84_C0", "label": "a = Packer()", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.9767, 0.0116, 0, 0.66, 0.8, 475, 3, 2, 0, 0, 593, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "Packer", "annotation": ""}, "snippet": "a = Packer('..\\\\chrome', '..\\\\plugin.zip')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L85_C0", "label": "a.tmppath =", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.9884, 0.0116, 0, 0.66, 0.9, 176, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "a.tmppath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "a.tmppath = '..\\\\output'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L86_C0", "label": "pack()", "type": "expression", "loc": [86, 86], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0116, 0, 0.66, 1.0, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": "a.pack()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L10_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L17_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L19_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L20_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L15_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:For_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L32_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L40_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L45_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L51_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L52_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L55_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L57_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L59_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L53_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L60_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L66_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L66_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L69_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_65:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_65:Expr_L82_C6"}]
#!/usr/bin/env python # # Copyright 2006, 2007 Google Inc. All Rights Reserved. # Author: danderson@google.com (David Anderson) # # Script for uploading files to a Google Code project. # # This is intended to be both a useful script for people who want to # streamline project uploads and a reference implementation for # uploading files to Google Code projects. # # To upload a file to Google Code, you need to provide a path to the # file on your local machine, a small summary of what the file is, a # project name, and a valid account that is a member or owner of that # project. You can optionally provide a list of labels that apply to # the file. The file will be uploaded under the same name that it has # in your local filesystem (that is, the "basename" or last path # component). Run the script with '--help' to get the exact syntax # and available options. # # Note that the upload script requests that you enter your # googlecode.com password. This is NOT your Gmail account password! # This is the password you use on googlecode.com for committing to # Subversion and uploading files. You can find your password by going # to http://code.google.com/hosting/settings when logged in with your # Gmail account. If you have already committed to your project's # Subversion repository, the script will automatically retrieve your # credentials from there (unless disabled, see the output of '--help' # for details). # # If you are looking at this script as a reference for implementing # your own Google Code file uploader, then you should take a look at # the upload() function, which is the meat of the uploader. You # basically need to build a multipart/form-data POST request with the # right fields and send it to https://PROJECT.googlecode.com/files . # Authenticate the request using HTTP Basic authentication, as is # shown below. # # Licensed under the terms of the Apache Software License 2.0: # http://www.apache.org/licenses/LICENSE-2.0 # # Questions, comments, feature requests and patches are most welcome. # Please direct all of these to the Google Code users group: # http://groups.google.com/group/google-code-hosting """Google Code file uploader script. """ __author__ = 'danderson@google.com (David Anderson)' import httplib import os.path import optparse import getpass import base64 import sys def upload(file, project_name, user_name, password, summary, labels=None): """Upload a file to a Google Code project's file server. Args: file: The local path to the file. project_name: The name of your project on Google Code. user_name: Your Google account name. password: The googlecode.com password for your account. Note that this is NOT your global Google Account password! summary: A small description for the file. labels: an optional list of label strings with which to tag the file. Returns: a tuple: http_status: 201 if the upload succeeded, something else if an error occured. http_reason: The human-readable string associated with http_status file_url: If the upload succeeded, the URL of the file on Google Code, None otherwise. """ # The login is the user part of user@gmail.com. If the login provided # is in the full user@domain form, strip it down. if user_name.endswith('@gmail.com'): user_name = user_name[:user_name.index('@gmail.com')] form_fields = [('summary', summary)] if labels is not None: form_fields.extend([('label', l.strip()) for l in labels]) content_type, body = encode_upload_request(form_fields, file) upload_host = '%s.googlecode.com' % project_name upload_uri = '/files' auth_token = base64.b64encode('%s:%s'% (user_name, password)) headers = { 'Authorization': 'Basic %s' % auth_token, 'User-Agent': 'Googlecode.com uploader v0.9.4', 'Content-Type': content_type, } server = httplib.HTTPSConnection(upload_host) server.request('POST', upload_uri, body, headers) resp = server.getresponse() server.close() if resp.status == 201: location = resp.getheader('Location', None) else: location = None return resp.status, resp.reason, location def encode_upload_request(fields, file_path): """Encode the given fields and file into a multipart form body. fields is a sequence of (name, value) pairs. file is the path of the file to upload. The file will be uploaded to Google Code with the same file name. Returns: (content_type, body) ready for httplib.HTTP instance """ BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla' CRLF = '\r\n' body = [] # Add the metadata about the upload first for key, value in fields: body.extend( ['--' + BOUNDARY, 'Content-Disposition: form-data; name="%s"' % key, '', value, ]) # Now add the file itself file_name = os.path.basename(file_path) f = open(file_path, 'rb') file_content = f.read() f.close() body.extend( ['--' + BOUNDARY, 'Content-Disposition: form-data; name="filename"; filename="%s"' % file_name, # The upload server determines the mime-type, no need to set it. 'Content-Type: application/octet-stream', '', file_content, ]) # Finalize the form body body.extend(['--' + BOUNDARY + '--', '']) return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body) def upload_find_auth(file_path, project_name, summary, labels=None, user_name=None, password=None, tries=3): """Find credentials and upload a file to a Google Code project's file server. file_path, project_name, summary, and labels are passed as-is to upload. Args: file_path: The local path to the file. project_name: The name of your project on Google Code. summary: A small description for the file. labels: an optional list of label strings with which to tag the file. config_dir: Path to Subversion configuration directory, 'none', or None. user_name: Your Google account name. tries: How many attempts to make. """ if user_name is None or password is None: from netrc import netrc authenticators = netrc().authenticators("code.google.com") if authenticators: if user_name is None: user_name = authenticators[0] if password is None: password = authenticators[2] while tries > 0: if user_name is None: # Read username if not specified or loaded from svn config, or on # subsequent tries. sys.stdout.write('Please enter your googlecode.com username: ') sys.stdout.flush() user_name = sys.stdin.readline().rstrip() if password is None: # Read password if not loaded from svn config, or on subsequent tries. print 'Please enter your googlecode.com password.' print '** Note that this is NOT your Gmail account password! **' print 'It is the password you use to access Subversion repositories,' print 'and can be found here: http://code.google.com/hosting/settings' password = getpass.getpass() status, reason, url = upload(file_path, project_name, user_name, password, summary, labels) # Returns 403 Forbidden instead of 401 Unauthorized for bad # credentials as of 2007-07-17. if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: # Rest for another try. user_name = password = None tries = tries - 1 else: # We're done. break return status, reason, url def main(): parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' '-p PROJECT [options] FILE') parser.add_option('-s', '--summary', dest='summary', help='Short description of the file') parser.add_option('-p', '--project', dest='project', help='Google Code project name') parser.add_option('-u', '--user', dest='user', help='Your Google Code username') parser.add_option('-w', '--password', dest='password', help='Your Google Code password') parser.add_option('-l', '--labels', dest='labels', help='An optional list of comma-separated labels to attach ' 'to the file') options, args = parser.parse_args() if not options.summary: parser.error('File summary is missing.') elif not options.project: parser.error('Project name is missing.') elif len(args) < 1: parser.error('File to upload not provided.') elif len(args) > 1: parser.error('Only one file may be specified.') file_path = args[0] if options.labels: labels = options.labels.split(',') else: labels = None status, reason, url = upload_find_auth(file_path, options.project, options.summary, labels, options.user, options.password) if url: print 'The file was uploaded successfully.' print 'URL: %s' % url return 0 else: print 'An error occurred. Your file was not uploaded.' print 'Google Code upload server said: %s (%s)' % (reason, status) return 1 if __name__ == '__main__': sys.exit(main())
ajibawa-2023/Python-Code-Large/train/row_66
98
256
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L46_C0", "label": "expression", "type": "expression", "loc": [46, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1816, 0.0078, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Google Code file uploader script.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L49_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.1914, 0.0039, 0, 0.66, 0.0833, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'danderson@google.com (David Anderson)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Import_L51_C0", "label": "httplib import httplib", "type": "import", "loc": [51, 51], "level": 0, "parent": null, "vector": [1, 0, 0.1992, 0.0039, 0, 0.66, 0.1667, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Import_L52_C0", "label": "os.path import os.path", "type": "import", "loc": [52, 52], "level": 0, "parent": null, "vector": [1, 0, 0.2031, 0.0039, 0, 0.66, 0.25, 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_66:Import_L53_C0", "label": "optparse import optparse", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.207, 0.0039, 0, 0.66, 0.3333, 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_66:Import_L54_C0", "label": "getpass import getpass", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 0.2109, 0.0039, 0, 0.66, 0.4167, 784, 0, 1, 0, 0, 784, 0, 0], "semantic": {"name": "getpass", "arg_names": [], "import_names": ["getpass"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Import_L55_C0", "label": "base64 import base64", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.2148, 0.0039, 0, 0.66, 0.5, 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_66:Import_L56_C0", "label": "sys import sys", "type": "import", "loc": [56, 56], "level": 0, "parent": null, "vector": [1, 0, 0.2188, 0.0039, 0, 0.66, 0.5833, 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_66:FunctionDef_L59_C0", "label": "upload", "type": "function", "loc": [59, 107], "level": 0, "parent": null, "vector": [2, 0, 0.3242, 0.1914, 0, 0.66, 0.6667, 920, 0, 6, 1, 0, 0, 0, 11], "semantic": {"name": "upload", "arg_names": ["file", "project_name", "user_name", "password", "summary", "labels"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload(file, project_name, user_name, password, summary, labels=None):\n \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [8, 1, 0.2676, 0.0703, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account.\n Note that this is NOT your global Google Account password!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L80_C2", "label": "if", "type": "if", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [4, 1, 0.3145, 0.0078, 1, 0.73, 0.0714, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name.endswith('@gmail.com'):\n user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L81_C4", "label": "user_name =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L80_C2", "vector": [14, 2, 0.3164, 0.0039, 2, 0.53, 0.0, 3, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L83_C2", "label": "form_fields =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3242, 0.0039, 1, 0.73, 0.1429, 486, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "form_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form_fields = [('summary', summary)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L84_C2", "label": "if", "type": "if", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [4, 1, 0.3301, 0.0078, 1, 0.73, 0.2143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if labels is not None:\n form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L85_C4", "label": "extend()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L84_C2", "vector": [8, 2, 0.332, 0.0039, 2, 0.03, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L87_C2", "label": "content_type, body = encode_upload_request()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3398, 0.0039, 1, 0.73, 0.2857, 433, 3, 2, 0, 0, 133, 10, 1], "semantic": {"name": "content_type, body", "arg_names": [], "import_names": [], "rhs_call_name": "encode_upload_request", "annotation": ""}, "snippet": " content_type, body = encode_upload_request(form_fields, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L89_C2", "label": "upload_host =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3477, 0.0039, 1, 0.73, 0.3571, 380, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upload_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_host = '%s.googlecode.com' % project_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L90_C2", "label": "upload_uri =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3516, 0.0039, 1, 0.73, 0.4286, 669, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "upload_uri", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_uri = '/files'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L91_C2", "label": "auth_token = b64encode()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3555, 0.0039, 1, 0.73, 0.5, 958, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "auth_token", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " auth_token = base64.b64encode('%s:%s'% (user_name, password))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L92_C2", "label": "headers =", "type": "assigned_variable", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3672, 0.0195, 1, 0.73, 0.5714, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'Authorization': 'Basic %s' % auth_token,\n 'User-Agent': 'Googlecode.com uploader v0.9.4',\n 'Content-Type': content_type,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L98_C2", "label": "server = HTTPSConnection()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3828, 0.0039, 1, 0.73, 0.6429, 268, 3, 1, 0, 0, 40, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPSConnection", "annotation": ""}, "snippet": " server = httplib.HTTPSConnection(upload_host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L99_C2", "label": "request()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [8, 1, 0.3867, 0.0039, 1, 0.73, 0.7143, 50, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " server.request('POST', upload_uri, body, headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L100_C2", "label": "resp = getresponse()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [14, 1, 0.3906, 0.0039, 1, 0.73, 0.7857, 48, 3, 0, 0, 0, 47, 10, 1], "semantic": {"name": "resp", "arg_names": [], "import_names": [], "rhs_call_name": "getresponse", "annotation": ""}, "snippet": " resp = server.getresponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L101_C2", "label": "close()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [8, 1, 0.3945, 0.0039, 1, 0.73, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " server.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2", "label": "if", "type": "if", "loc": [103, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [4, 1, 0.4082, 0.0156, 1, 0.73, 0.9286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp.status == 201:\n location = resp.getheader('Location', None)\n else:\n location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L104_C4", "label": "location = getheader()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2", "vector": [14, 2, 0.4062, 0.0039, 2, 0.18, 0.0, 771, 3, 2, 0, 0, 644, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "getheader", "annotation": ""}, "snippet": " location = resp.getheader('Location', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L106_C4", "label": "location =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2", "vector": [14, 2, 0.4141, 0.0039, 2, 0.18, 1.0, 771, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L107_C2", "label": "return", "type": "return", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "vector": [13, 1, 0.418, 0.0039, 1, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resp.status, resp.reason, location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "label": "encode_upload_request", "type": "function", "loc": [110, 152], "level": 0, "parent": null, "vector": [2, 0, 0.5117, 0.168, 0, 0.66, 0.75, 133, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "encode_upload_request", "arg_names": ["fields", "file_path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_upload_request(fields, file_path):\n \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L111_C2", "label": "expression", "type": "expression", "loc": [111, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [8, 1, 0.4473, 0.0312, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L119_C2", "label": "BOUNDARY =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.4648, 0.0039, 1, 0.17, 0.0909, 677, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDARY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L120_C2", "label": "CRLF =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.4688, 0.0039, 1, 0.17, 0.1818, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CRLF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CRLF = '\\r\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L122_C2", "label": "body =", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.4766, 0.0039, 1, 0.17, 0.2727, 477, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:For_L125_C2", "label": "for key, value", "type": "for", "loc": [125, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [6, 1, 0.5, 0.0273, 1, 0.17, 0.3636, 839, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in fields:\n body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L126_C4", "label": "extend()", "type": "expression", "loc": [126, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:For_L125_C2", "vector": [8, 2, 0.502, 0.0234, 2, 0.1, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L134_C2", "label": "file_name = basename()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.5234, 0.0039, 1, 0.17, 0.4545, 991, 3, 1, 0, 0, 164, 10, 1], "semantic": {"name": "file_name", "arg_names": [], "import_names": [], "rhs_call_name": "basename", "annotation": ""}, "snippet": " file_name = os.path.basename(file_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L135_C2", "label": "f = open()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.5273, 0.0039, 1, 0.17, 0.5455, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(file_path, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L136_C2", "label": "file_content = read()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [14, 1, 0.5312, 0.0039, 1, 0.17, 0.6364, 412, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "file_content", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " file_content = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L137_C2", "label": "close()", "type": "expression", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [8, 1, 0.5352, 0.0039, 1, 0.17, 0.7273, 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_66:Expr_L139_C2", "label": "extend()", "type": "expression", "loc": [139, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [8, 1, 0.5586, 0.0352, 1, 0.17, 0.8182, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"filename\"; filename=\"%s\"'\n % file_name,\n # The upload server determines the mime-type, no need to set it.\n 'Content-Type: application/octet-stream',\n '',\n file_content,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L150_C2", "label": "extend()", "type": "expression", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [8, 1, 0.5859, 0.0039, 1, 0.17, 0.9091, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(['--' + BOUNDARY + '--', ''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L152_C2", "label": "return", "type": "return", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "vector": [13, 1, 0.5938, 0.0039, 1, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "label": "upload_find_auth", "type": "function", "loc": [155, 206], "level": 0, "parent": null, "vector": [2, 0, 0.7051, 0.2031, 0, 0.66, 0.8333, 28, 0, 7, 1, 0, 0, 0, 12], "semantic": {"name": "upload_find_auth", "arg_names": ["file_path", "project_name", "summary", "labels", "user_name", "password", "tries"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload_find_auth(file_path, project_name, summary, labels=None,\n user_name=None, password=None, tries=3):\n \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L157_C2", "label": "expression", "type": "expression", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "vector": [8, 1, 0.6367, 0.0508, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file.\n project_name: The name of your project on Google Code.\n summary: A small description for the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "label": "if", "type": "if", "loc": [170, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "vector": [4, 1, 0.6777, 0.0312, 1, 0.06, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name is None or password is None:\n from netrc import netrc\n authenticators = netrc().authenticators(\"code.google.com\")\n if authenticators:\n if user_name is None:\n user_name = authenticators[0]\n if password is None:\n password = authenticators[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:ImportFrom_L171_C4", "label": "from netrc import netrc", "type": "import", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "vector": [1, 2, 0.668, 0.0039, 2, 0.54, 0.0, 792, 0, 1, 0, 0, 792, 0, 0], "semantic": {"name": "netrc", "arg_names": [], "import_names": ["netrc"], "rhs_call_name": "", "annotation": ""}, "snippet": " from netrc import netrc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L172_C4", "label": "authenticators = authenticators()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "vector": [14, 2, 0.6719, 0.0039, 2, 0.54, 0.5, 564, 3, 1, 0, 0, 564, 10, 2], "semantic": {"name": "authenticators", "arg_names": [], "import_names": [], "rhs_call_name": "authenticators", "annotation": ""}, "snippet": " authenticators = netrc().authenticators(\"code.google.com\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4", "label": "if", "type": "if", "loc": [173, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "vector": [4, 2, 0.6836, 0.0195, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if authenticators:\n if user_name is None:\n user_name = authenticators[0]\n if password is None:\n password = authenticators[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L174_C6", "label": "if", "type": "if", "loc": [174, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4", "vector": [4, 3, 0.6816, 0.0078, 3, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name is None:\n user_name = authenticators[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L175_C8", "label": "user_name =", "type": "assigned_variable", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L174_C6", "vector": [14, 4, 0.6836, 0.0039, 4, 0.32, 0.0, 3, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = authenticators[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L176_C6", "label": "if", "type": "if", "loc": [176, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4", "vector": [4, 3, 0.6895, 0.0078, 3, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if password is None:\n password = authenticators[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L177_C8", "label": "password =", "type": "assigned_variable", "loc": [177, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L176_C6", "vector": [14, 4, 0.6914, 0.0039, 4, 0.5, 0.0, 489, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " password = authenticators[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "label": "while", "type": "while", "loc": [179, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "vector": [5, 1, 0.748, 0.1016, 1, 0.06, 0.6667, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while tries > 0:\n if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()\n if password is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "label": "if", "type": "if", "loc": [180, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "vector": [4, 2, 0.7129, 0.0234, 2, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L183_C6", "label": "write()", "type": "expression", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "vector": [8, 3, 0.7148, 0.0039, 3, 0.12, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write('Please enter your googlecode.com username: ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L184_C6", "label": "flush()", "type": "expression", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "vector": [8, 3, 0.7188, 0.0039, 3, 0.12, 0.5, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " sys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L185_C6", "label": "user_name = rstrip()", "type": "assigned_variable", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "vector": [14, 3, 0.7227, 0.0039, 3, 0.12, 1.0, 3, 3, 0, 0, 0, 807, 10, 2], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "rstrip", "annotation": ""}, "snippet": " user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "label": "if", "type": "if", "loc": [186, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "vector": [4, 2, 0.7383, 0.0273, 2, 0.92, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if password is None:\n # Read password if not loaded from svn config, or on subsequent tries.\n print('Please enter your googlecode.com password.')\n print('** Note that this is NOT your Gmail account password! **')\n print('It is the password you use to access Subversion repositories,')\n print('and can be found here: http://code.google.com/hosting/settings')\n password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L188_C6", "label": "print()", "type": "expression", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "vector": [8, 3, 0.7344, 0.0039, 3, 0.02, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please enter your googlecode.com password.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L189_C6", "label": "print()", "type": "expression", "loc": [189, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "vector": [8, 3, 0.7383, 0.0039, 3, 0.02, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('** Note that this is NOT your Gmail account password! **')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L190_C6", "label": "print()", "type": "expression", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "vector": [8, 3, 0.7422, 0.0039, 3, 0.02, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('It is the password you use to access Subversion repositories,')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L191_C6", "label": "print()", "type": "expression", "loc": [191, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "vector": [8, 3, 0.7461, 0.0039, 3, 0.02, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('and can be found here: http://code.google.com/hosting/settings')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L192_C6", "label": "password = getpass()", "type": "assigned_variable", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "vector": [14, 3, 0.75, 0.0039, 3, 0.02, 1.0, 489, 3, 0, 0, 0, 784, 10, 1], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "getpass", "annotation": ""}, "snippet": " password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L194_C4", "label": "status, reason, url = upload()", "type": "assigned_variable", "loc": [194, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "vector": [14, 2, 0.7598, 0.0078, 2, 0.92, 0.6667, 92, 3, 6, 0, 0, 920, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload", "annotation": ""}, "snippet": " status, reason, url = upload(file_path, project_name, user_name, password,\n summary, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4", "label": "if", "type": "if", "loc": [198, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "vector": [4, 2, 0.7852, 0.0273, 2, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:\n # Rest for another try.\n user_name = password = None\n tries = tries - 1\n else:\n # We're done.\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L200_C6", "label": "user_name =", "type": "assigned_variable", "loc": [200, 200], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4", "vector": [14, 3, 0.7812, 0.0039, 3, 0.39, 0.0, 3, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = password = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L201_C6", "label": "tries =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4", "vector": [14, 3, 0.7852, 0.0039, 3, 0.39, 1.0, 915, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tries = tries - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L206_C2", "label": "return", "type": "return", "loc": [206, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "vector": [13, 1, 0.8047, 0.0039, 1, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status, reason, url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "label": "main", "type": "function", "loc": [209, 252], "level": 0, "parent": null, "vector": [2, 0, 0.9004, 0.1719, 0, 0.66, 0.9167, 624, 0, 0, 1, 0, 0, 0, 19], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')\n parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')\n parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')\n parser.add_option('-u', '--user', dest='user',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L210_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [210, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [14, 1, 0.8223, 0.0078, 1, 0.1, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L212_C2", "label": "add_option()", "type": "expression", "loc": [212, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [8, 1, 0.8301, 0.0078, 1, 0.1, 0.0909, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L214_C2", "label": "add_option()", "type": "expression", "loc": [214, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [8, 1, 0.8379, 0.0078, 1, 0.1, 0.1818, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L216_C2", "label": "add_option()", "type": "expression", "loc": [216, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [8, 1, 0.8457, 0.0078, 1, 0.1, 0.2727, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-u', '--user', dest='user',\n help='Your Google Code username')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L218_C2", "label": "add_option()", "type": "expression", "loc": [218, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [8, 1, 0.8535, 0.0078, 1, 0.1, 0.3636, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-w', '--password', dest='password',\n help='Your Google Code password')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L220_C2", "label": "add_option()", "type": "expression", "loc": [220, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [8, 1, 0.8633, 0.0117, 1, 0.1, 0.4545, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-l', '--labels', dest='labels',\n help='An optional list of comma-separated labels to attach '\n 'to the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L224_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [14, 1, 0.875, 0.0039, 1, 0.1, 0.5455, 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_66:If_L226_C2", "label": "if", "type": "if", "loc": [226, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [4, 1, 0.8965, 0.0312, 1, 0.1, 0.6364, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not options.summary:\n parser.error('File summary is missing.')\n elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L227_C4", "label": "error()", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L226_C2", "vector": [8, 2, 0.8867, 0.0039, 2, 0.06, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File summary is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2", "label": "if", "type": "if", "loc": [228, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L226_C2", "vector": [4, 2, 0.9004, 0.0234, 2, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L229_C4", "label": "error()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2", "vector": [8, 3, 0.8945, 0.0039, 3, 0.0, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Project name is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2", "label": "if", "type": "if", "loc": [230, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2", "vector": [4, 3, 0.9043, 0.0156, 3, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L231_C4", "label": "error()", "type": "expression", "loc": [231, 231], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2", "vector": [8, 4, 0.9023, 0.0039, 4, 0.2, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File to upload not provided.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L232_C2", "label": "if", "type": "if", "loc": [232, 233], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2", "vector": [4, 4, 0.9082, 0.0078, 4, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L233_C4", "label": "error()", "type": "expression", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L232_C2", "vector": [8, 5, 0.9102, 0.0039, 5, 0.64, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L235_C2", "label": "file_path =", "type": "assigned_variable", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [14, 1, 0.918, 0.0039, 1, 0.1, 0.7273, 397, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_path = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2", "label": "if", "type": "if", "loc": [237, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [4, 1, 0.9316, 0.0156, 1, 0.1, 0.8182, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.labels:\n labels = options.labels.split(',')\n else:\n labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L238_C4", "label": "labels = split()", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2", "vector": [14, 2, 0.9297, 0.0039, 2, 0.3, 0.0, 283, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " labels = options.labels.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L240_C4", "label": "labels =", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2", "vector": [14, 2, 0.9375, 0.0039, 2, 0.3, 1.0, 283, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L242_C2", "label": "status, reason, url = upload_find_auth()", "type": "assigned_variable", "loc": [242, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [14, 1, 0.9492, 0.0117, 1, 0.1, 0.9091, 92, 3, 6, 0, 0, 28, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload_find_auth", "annotation": ""}, "snippet": " status, reason, url = upload_find_auth(file_path, options.project,\n options.summary, labels,\n options.user, options.password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "label": "if", "type": "if", "loc": [245, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "vector": [4, 1, 0.9707, 0.0312, 1, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url:\n print('The file was uploaded successfully.')\n print('URL: %s' % url)\n return 0\n else:\n print('An error occurred. Your file was not uploaded.')\n print('Google Code upload server said: %s (%s)' % (reason, status))\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L246_C4", "label": "print()", "type": "expression", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [8, 2, 0.9609, 0.0039, 2, 0.06, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The file was uploaded successfully.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L247_C4", "label": "print()", "type": "expression", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [8, 2, 0.9648, 0.0039, 2, 0.06, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('URL: %s' % url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L248_C4", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [13, 2, 0.9688, 0.0039, 2, 0.06, 0.4, 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_66:Expr_L250_C4", "label": "print()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [8, 2, 0.9766, 0.0039, 2, 0.06, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('An error occurred. Your file was not uploaded.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L251_C4", "label": "print()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [8, 2, 0.9805, 0.0039, 2, 0.06, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Google Code upload server said: %s (%s)' % (reason, status))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L252_C4", "label": "return", "type": "return", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "vector": [13, 2, 0.9844, 0.0039, 2, 0.06, 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_66:If_L255_C0", "label": "if", "type": "if", "loc": [255, 256], "level": 0, "parent": null, "vector": [4, 0, 0.998, 0.0078, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n sys.exit(main())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L256_C2", "label": "exit()", "type": "expression", "loc": [256, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_66:If_L255_C0", "vector": [8, 1, 1.0, 0.0039, 1, 0.25, 0.0, 436, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(main())"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L107_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:For_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:ImportFrom_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L170_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L174_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L174_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L176_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L176_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L183_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L184_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L185_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L188_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L189_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L190_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L191_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L192_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:While_L179_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L200_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L201_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L206_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L218_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L224_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L226_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L226_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L226_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L232_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L232_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L235_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Assign_L242_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:FunctionDef_L209_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Return_L252_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_66:If_L255_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_66:Expr_L256_C2"}]
# Copyright (c) 2012 eagleonhill(qiuc12@gmail.com). All rights reserved. # Use of this source code is governed by a Mozilla-1.1 license that can be # found in the LICENSE file. import googlecode_upload import tempfile import urllib2 import optparse import os extensionid = 'lgllffgicojgllpmdbemgglaponefajn' def download(): url = ("https://clients2.google.com/service/update2/crx?" "response=redirect&x=id%3D" + extensionid + "%26uc") response = urllib2.urlopen(url) filename = response.geturl().split('/')[-1] version = '.'.join(filename.replace('_', '.').split('.')[1:-1]) name = os.path.join(tempfile.gettempdir(), filename) f = open(name, 'wb') data = response.read() f.write(data) f.close() return name, version def upload(path, version, user, password): summary = 'Extension version ' + version + ' download' labels = ['Type-Executable'] print googlecode_upload.upload( path, 'np-activex', user, password, summary, labels) def main(): parser = optparse.OptionParser() parser.add_option('-u', '--user', dest='user', help='Your Google Code username') parser.add_option('-w', '--password', dest='password', help='Your Google Code password') options, args = parser.parse_args() name, version = download() print 'File downloaded ', name, version upload(name, version, options.user, options.password) os.remove(name) if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_67
31
43
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_67:Import_L4_C0", "label": "googlecode_upload import googlecode_upload", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.093, 0.0233, 0, 0.66, 0.0, 481, 0, 1, 0, 0, 481, 0, 0], "semantic": {"name": "googlecode_upload", "arg_names": [], "import_names": ["googlecode_upload"], "rhs_call_name": "", "annotation": ""}, "snippet": "import googlecode_upload"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Import_L5_C0", "label": "tempfile import tempfile", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1163, 0.0233, 0, 0.66, 0.1111, 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_67:Import_L6_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1395, 0.0233, 0, 0.66, 0.2222, 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_67:Import_L7_C0", "label": "optparse import optparse", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1628, 0.0233, 0, 0.66, 0.3333, 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_67:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.186, 0.0233, 0, 0.66, 0.4444, 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_67:Assign_L10_C0", "label": "extensionid =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.2326, 0.0233, 0, 0.66, 0.5556, 156, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "extensionid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "extensionid = 'lgllffgicojgllpmdbemgglaponefajn'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "label": "download", "type": "function", "loc": [12, 23], "level": 0, "parent": null, "vector": [2, 0, 0.407, 0.2791, 0, 0.66, 0.6667, 0, 0, 0, 1, 0, 0, 0, 12], "semantic": {"name": "download", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download():\n url = (\"https://clients2.google.com/service/update2/crx?\"\n \"response=redirect&x=id%3D\" + extensionid + \"%26uc\")\n response = urllib2.urlopen(url)\n filename = response.geturl().split('/')[-1]\n version = '.'.join(filename.replace('_', '.').split('.')[1:-1])\n name = os.path.join(tempfile.gettempdir(), filename)\n f = open(name, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L13_C2", "label": "url =", "type": "assigned_variable", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.314, 0.0465, 1, 0.54, 0.0, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = (\"https://clients2.google.com/service/update2/crx?\"\n \"response=redirect&x=id%3D\" + extensionid + \"%26uc\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L15_C2", "label": "response = urlopen()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.3488, 0.0233, 1, 0.54, 0.1111, 511, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " response = urllib2.urlopen(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L16_C2", "label": "filename =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.3721, 0.0233, 1, 0.54, 0.2222, 275, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = response.geturl().split('/')[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L17_C2", "label": "version = join()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.3953, 0.0233, 1, 0.54, 0.3333, 623, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " version = '.'.join(filename.replace('_', '.').split('.')[1:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L18_C2", "label": "name = join()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.4186, 0.0233, 1, 0.54, 0.4444, 57, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " name = os.path.join(tempfile.gettempdir(), filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L19_C2", "label": "f = open()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.4419, 0.0233, 1, 0.54, 0.5556, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(name, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L20_C2", "label": "data = read()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [14, 1, 0.4651, 0.0233, 1, 0.54, 0.6667, 929, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = response.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L21_C2", "label": "write()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [8, 1, 0.4884, 0.0233, 1, 0.54, 0.7778, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L22_C2", "label": "close()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [8, 1, 0.5116, 0.0233, 1, 0.54, 0.8889, 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_67:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "vector": [13, 1, 0.5349, 0.0233, 1, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return name, version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L25_C0", "label": "upload", "type": "function", "loc": [25, 27], "level": 0, "parent": null, "vector": [2, 0, 0.6047, 0.0698, 0, 0.66, 0.7778, 920, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "upload", "arg_names": ["path", "version", "user", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload(path, version, user, password):\n summary = 'Extension version ' + version + ' download'\n labels = ['Type-Executable']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L26_C2", "label": "summary =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L25_C0", "vector": [14, 1, 0.6047, 0.0233, 1, 0.04, 0.0, 977, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "summary", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " summary = 'Extension version ' + version + ' download'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L27_C2", "label": "labels =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L25_C0", "vector": [14, 1, 0.6279, 0.0233, 1, 0.04, 1.0, 283, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = ['Type-Executable']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "label": "main", "type": "function", "loc": [29, 40], "level": 0, "parent": null, "vector": [2, 0, 0.8023, 0.2791, 0, 0.66, 0.8889, 624, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser()\n parser.add_option('-u', '--user', dest='user',\n help='Your Google Code username')\n parser.add_option('-w', '--password', dest='password',\n help='Your Google Code password')\n \n options, args = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L30_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [14, 1, 0.6977, 0.0233, 1, 0.74, 0.0, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L31_C2", "label": "add_option()", "type": "expression", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [8, 1, 0.7326, 0.0465, 1, 0.74, 0.1429, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-u', '--user', dest='user',\n help='Your Google Code username')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L33_C2", "label": "add_option()", "type": "expression", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [8, 1, 0.7791, 0.0465, 1, 0.74, 0.2857, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-w', '--password', dest='password',\n help='Your Google Code password')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L36_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [14, 1, 0.8372, 0.0233, 1, 0.74, 0.4286, 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_67:Assign_L37_C2", "label": "name, version = download()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [14, 1, 0.8605, 0.0233, 1, 0.74, 0.5714, 199, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "name, version", "arg_names": [], "import_names": [], "rhs_call_name": "download", "annotation": ""}, "snippet": " name, version = download()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L38_C2", "label": "print()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [8, 1, 0.8837, 0.0233, 1, 0.74, 0.7143, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File downloaded ', name, version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L39_C2", "label": "upload()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [8, 1, 0.907, 0.0233, 1, 0.74, 0.8571, 920, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "upload", "arg_names": [], "import_names": [], "rhs_call_name": "upload", "annotation": ""}, "snippet": " upload(name, version, options.user, options.password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L40_C2", "label": "remove()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "vector": [8, 1, 0.9302, 0.0233, 1, 0.74, 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(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_67:If_L42_C0", "label": "if", "type": "if", "loc": [42, 43], "level": 0, "parent": null, "vector": [4, 0, 0.9884, 0.0465, 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_67:Expr_L43_C2", "label": "main()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_67:If_L42_C0", "vector": [8, 1, 1.0, 0.0233, 1, 0.87, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_67:If_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_67:Expr_L43_C2"}]
maxVf = 200 # Generating the header head = """// Copyright qiuc12@gmail.com // This file is generated autmatically by python. DONT MODIFY IT! #pragma once #include <OleAuto.h> class FakeDispatcher; HRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...); extern "C" void DualProcessCommandWrap(); class FakeDispatcherBase : public IDispatch { private:""" pattern = """ \tvirtual HRESULT __stdcall fv{0}(char x) {{ \t\tva_list va = &x; \t\tHRESULT ret = ProcessCommand({0}, va); \t\tva_end(va); \t\treturn ret; \t}} """ pattern = """ \tvirtual HRESULT __stdcall fv{0}();""" end = """ protected: \tconst static int kMaxVf = {0}; }}; """ f = open("FakeDispatcherBase.h", "w") f.write(head) for i in range(0, maxVf): f.write(pattern.format(i)) f.write(end.format(maxVf)) f.close() head = """; Copyright qiuc12@gmail.com ; This file is generated automatically by python. DON'T MODIFY IT! """ f = open("FakeDispatcherBase.asm", "w") f.write(head) f.write(".386\n") f.write(".model flat\n") f.write("_DualProcessCommandWrap proto\n") ObjFormat = "?fv{0}@FakeDispatcherBase@@EAGJXZ" for i in range(0, maxVf): f.write("PUBLIC " + ObjFormat.format(i) + "\n") f.write(".code\n") for i in range(0, maxVf): f.write(ObjFormat.format(i) + " proc\n") f.write(" push {0}\n".format(i)) f.write(" jmp _DualProcessCommandWrap\n") f.write(ObjFormat.format(i) + " endp\n") f.write("\nend\n") f.close()
ajibawa-2023/Python-Code-Large/train/row_68
28
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_68:Assign_L1_C0", "label": "maxVf =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0172, 0.0172, 0, 0.66, 0.0, 302, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "maxVf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "maxVf = 200"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L4_C0", "label": "head =", "type": "assigned_variable", "loc": [4, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1466, 0.1724, 0, 0.66, 0.0476, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "head = \"\"\"// Copyright qiuc12@gmail.com\n// This file is generated autmatically by python. DONT MODIFY IT!\n\n#pragma once\n#include <OleAuto.h>\nclass FakeDispatcher;\nHRESULT DualProcessCommand(int commandId, FakeDispatcher *disp, ...);\nextern \"C\" void DualProcessCommandWrap();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L15_C0", "label": "pattern =", "type": "assigned_variable", "loc": [15, 22], "level": 0, "parent": null, "vector": [14, 0, 0.319, 0.1379, 0, 0.66, 0.0952, 561, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pattern = \"\"\"\n\\tvirtual HRESULT __stdcall fv{0}(char x) {{\n\\t\\tva_list va = &x;\n\\t\\tHRESULT ret = ProcessCommand({0}, va);\n\\t\\tva_end(va);\n\\t\\treturn ret;\n\\t}}\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L23_C0", "label": "pattern =", "type": "assigned_variable", "loc": [23, 24], "level": 0, "parent": null, "vector": [14, 0, 0.4052, 0.0345, 0, 0.66, 0.1429, 561, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pattern = \"\"\"\n\\tvirtual HRESULT __stdcall fv{0}();\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L26_C0", "label": "end =", "type": "assigned_variable", "loc": [26, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4914, 0.1034, 0, 0.66, 0.1905, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "end = \"\"\"\nprotected:\n\\tconst static int kMaxVf = {0};\n\n}};\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L32_C0", "label": "f = open()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.5517, 0.0172, 0, 0.66, 0.2381, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"FakeDispatcherBase.h\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L33_C0", "label": "write()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.569, 0.0172, 0, 0.66, 0.2857, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(head)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:For_L35_C0", "label": "for i", "type": "for", "loc": [35, 36], "level": 0, "parent": null, "vector": [6, 0, 0.6121, 0.0345, 0, 0.66, 0.3333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(pattern.format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L36_C4", "label": "write()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L35_C0", "vector": [8, 1, 0.6207, 0.0172, 1, 0.87, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(pattern.format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L38_C0", "label": "write()", "type": "expression", "loc": [38, 38], "level": 0, "parent": null, "vector": [8, 0, 0.6552, 0.0172, 0, 0.66, 0.381, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(end.format(maxVf))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L39_C0", "label": "close()", "type": "expression", "loc": [39, 39], "level": 0, "parent": null, "vector": [8, 0, 0.6724, 0.0172, 0, 0.66, 0.4286, 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_68:Assign_L40_C0", "label": "head =", "type": "assigned_variable", "loc": [40, 42], "level": 0, "parent": null, "vector": [14, 0, 0.7069, 0.0517, 0, 0.66, 0.4762, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "head", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "head = \"\"\"; Copyright qiuc12@gmail.com\n; This file is generated automatically by python. DON'T MODIFY IT!\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L43_C0", "label": "f = open()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.7414, 0.0172, 0, 0.66, 0.5238, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "f = open(\"FakeDispatcherBase.asm\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L44_C0", "label": "write()", "type": "expression", "loc": [44, 44], "level": 0, "parent": null, "vector": [8, 0, 0.7586, 0.0172, 0, 0.66, 0.5714, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(head)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L45_C0", "label": "write()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.7759, 0.0172, 0, 0.66, 0.619, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".386\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L46_C0", "label": "write()", "type": "expression", "loc": [46, 46], "level": 0, "parent": null, "vector": [8, 0, 0.7931, 0.0172, 0, 0.66, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".model flat\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L47_C0", "label": "write()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.8103, 0.0172, 0, 0.66, 0.7143, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\"_DualProcessCommandWrap proto\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Assign_L48_C0", "label": "ObjFormat =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.8276, 0.0172, 0, 0.66, 0.7619, 675, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ObjFormat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ObjFormat = \"?fv{0}@FakeDispatcherBase@@EAGJXZ\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:For_L49_C0", "label": "for i", "type": "for", "loc": [49, 50], "level": 0, "parent": null, "vector": [6, 0, 0.8534, 0.0345, 0, 0.66, 0.8095, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(\"PUBLIC \" + ObjFormat.format(i) + \"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L50_C4", "label": "write()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L49_C0", "vector": [8, 1, 0.8621, 0.0172, 1, 0.3, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\"PUBLIC \" + ObjFormat.format(i) + \"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L51_C0", "label": "write()", "type": "expression", "loc": [51, 51], "level": 0, "parent": null, "vector": [8, 0, 0.8793, 0.0172, 0, 0.66, 0.8571, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\".code\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "label": "for i", "type": "for", "loc": [52, 56], "level": 0, "parent": null, "vector": [6, 0, 0.931, 0.0862, 0, 0.66, 0.9048, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0, maxVf):\n f.write(ObjFormat.format(i) + \" proc\\n\")\n f.write(\" push {0}\\n\".format(i))\n f.write(\" jmp _DualProcessCommandWrap\\n\")\n f.write(ObjFormat.format(i) + \" endp\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L53_C4", "label": "write()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "vector": [8, 1, 0.9138, 0.0172, 1, 0.14, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(ObjFormat.format(i) + \" proc\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L54_C4", "label": "write()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "vector": [8, 1, 0.931, 0.0172, 1, 0.14, 0.3333, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\" push {0}\\n\".format(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L55_C4", "label": "write()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "vector": [8, 1, 0.9483, 0.0172, 1, 0.14, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(\" jmp _DualProcessCommandWrap\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L56_C4", "label": "write()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "vector": [8, 1, 0.9655, 0.0172, 1, 0.14, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(ObjFormat.format(i) + \" endp\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L57_C0", "label": "write()", "type": "expression", "loc": [57, 57], "level": 0, "parent": null, "vector": [8, 0, 0.9828, 0.0172, 0, 0.66, 0.9524, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "f.write(\"\\nend\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L58_C0", "label": "close()", "type": "expression", "loc": [58, 58], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0172, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "f.close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_68:For_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_68:Expr_L56_C4"}]
import time def yesno(question): val = raw_input(question + " ") return val.startswith("y") or val.startswith("Y") use_pysqlite2 = yesno("Use pysqlite 2.0?") use_autocommit = yesno("Use autocommit?") use_executemany= yesno("Use executemany?") if use_pysqlite2: from pysqlite2 import dbapi2 as sqlite else: import sqlite def create_db(): con = sqlite.connect(":memory:") if use_autocommit: if use_pysqlite2: con.isolation_level = None else: con.autocommit = True cur = con.cursor() cur.execute(""" create table test(v text, f float, i integer) """) cur.close() return con def test(): row = ("sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd", 3.14, 42) l = [] for i in range(1000): l.append(row) con = create_db() cur = con.cursor() if sqlite.version_info > (2, 0): sql = "insert into test(v, f, i) values (?, ?, ?)" else: sql = "insert into test(v, f, i) values (%s, %s, %s)" starttime = time.time() for i in range(50): if use_executemany: cur.executemany(sql, l) else: for r in l: cur.execute(sql, r) endtime = time.time() print "elapsed", endtime - starttime cur.execute("select count(*) from test") print "rows:", cur.fetchone()[0] if __name__ == "__main__": test()
ajibawa-2023/Python-Code-Large/train/row_69
42
61
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_69:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 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_69:FunctionDef_L3_C0", "label": "yesno", "type": "function", "loc": [3, 5], "level": 0, "parent": null, "vector": [2, 0, 0.0656, 0.0492, 0, 0.66, 0.125, 796, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "yesno", "arg_names": ["question"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L4_C4", "label": "val = raw_input()", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L3_C0", "vector": [14, 1, 0.0656, 0.0164, 1, 0.36, 0.0, 618, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " val = raw_input(question + \" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L3_C0", "vector": [13, 1, 0.082, 0.0164, 1, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L7_C0", "label": "use_pysqlite2 = yesno()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1148, 0.0164, 0, 0.66, 0.25, 516, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_pysqlite2", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L8_C0", "label": "use_autocommit = yesno()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1311, 0.0164, 0, 0.66, 0.375, 788, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_autocommit", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_autocommit = yesno(\"Use autocommit?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L9_C0", "label": "use_executemany = yesno()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1475, 0.0164, 0, 0.66, 0.5, 502, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_executemany", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_executemany= yesno(\"Use executemany?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L11_C0", "label": "if", "type": "if", "loc": [11, 14], "level": 0, "parent": null, "vector": [4, 0, 0.2049, 0.0656, 0, 0.66, 0.625, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n from pysqlite2 import dbapi2 as sqlite\nelse:\n import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:ImportFrom_L12_C4", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L11_C0", "vector": [1, 1, 0.1967, 0.0164, 1, 0.18, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Import_L14_C4", "label": "sqlite import sqlite", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L11_C0", "vector": [1, 1, 0.2295, 0.0164, 1, 0.18, 1.0, 301, 0, 1, 0, 0, 301, 0, 0], "semantic": {"name": "sqlite", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "label": "create_db", "type": "function", "loc": [17, 29], "level": 0, "parent": null, "vector": [2, 0, 0.377, 0.2131, 0, 0.66, 0.75, 487, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "create_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_db():\n con = sqlite.connect(\":memory:\")\n if use_autocommit:\n if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L18_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [14, 1, 0.2951, 0.0164, 1, 0.17, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L19_C4", "label": "if", "type": "if", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [4, 1, 0.3443, 0.082, 1, 0.17, 0.2, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_autocommit:\n if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8", "label": "if", "type": "if", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L19_C4", "vector": [4, 2, 0.3525, 0.0656, 2, 0.22, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L21_C12", "label": "con.isolation_level =", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8", "vector": [14, 3, 0.3443, 0.0164, 3, 0.3, 0.0, 91, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "con.isolation_level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.isolation_level = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L23_C12", "label": "con.autocommit =", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8", "vector": [14, 3, 0.377, 0.0164, 3, 0.3, 1.0, 13, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "con.autocommit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L24_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [14, 1, 0.3934, 0.0164, 1, 0.17, 0.4, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L25_C4", "label": "execute()", "type": "expression", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [8, 1, 0.4262, 0.0492, 1, 0.17, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"\"\"\n create table test(v text, f float, i integer)\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L28_C4", "label": "close()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [8, 1, 0.459, 0.0164, 1, 0.17, 0.8, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "vector": [13, 1, 0.4754, 0.0164, 1, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return con"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "label": "test", "type": "function", "loc": [31, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7213, 0.4426, 0, 0.66, 0.875, 224, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)\n l = []\n for i in range(1000):\n l.append(row)\n\n con = create_db()\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L32_C4", "label": "row =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.5246, 0.0164, 1, 0.72, 0.0, 767, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L33_C4", "label": "l =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.541, 0.0164, 1, 0.72, 0.0909, 810, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:For_L34_C4", "label": "for i", "type": "for", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [6, 1, 0.5656, 0.0328, 1, 0.72, 0.1818, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1000):\n l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L35_C8", "label": "append()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:For_L34_C4", "vector": [8, 2, 0.5738, 0.0164, 2, 0.57, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L37_C4", "label": "con = create_db()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.6066, 0.0164, 1, 0.72, 0.2727, 761, 3, 0, 0, 0, 487, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "create_db", "annotation": ""}, "snippet": " con = create_db()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L38_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.623, 0.0164, 1, 0.72, 0.3636, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4", "label": "if", "type": "if", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [4, 1, 0.6803, 0.0656, 1, 0.72, 0.4545, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n sql = \"insert into test(v, f, i) values (?, ?, ?)\"\n else:\n sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L41_C8", "label": "sql =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4", "vector": [14, 2, 0.6721, 0.0164, 2, 0.07, 0.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (?, ?, ?)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L43_C8", "label": "sql =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4", "vector": [14, 2, 0.7049, 0.0164, 2, 0.07, 1.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L45_C4", "label": "starttime = time()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.7377, 0.0164, 1, 0.72, 0.5455, 864, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "starttime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " starttime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:For_L46_C4", "label": "for i", "type": "for", "loc": [46, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [6, 1, 0.7951, 0.0984, 1, 0.72, 0.6364, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n if use_executemany:\n cur.executemany(sql, l)\n else:\n for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8", "label": "if", "type": "if", "loc": [47, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:For_L46_C4", "vector": [4, 2, 0.8033, 0.082, 2, 0.64, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_executemany:\n cur.executemany(sql, l)\n else:\n for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L48_C12", "label": "executemany()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8", "vector": [8, 3, 0.7869, 0.0164, 3, 0.69, 0.0, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:For_L50_C12", "label": "for r", "type": "for", "loc": [50, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8", "vector": [6, 3, 0.8279, 0.0328, 3, 0.69, 1.0, 436, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L51_C16", "label": "execute()", "type": "expression", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:For_L50_C12", "vector": [8, 4, 0.8361, 0.0164, 4, 0.16, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L52_C4", "label": "endtime = time()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [14, 1, 0.8525, 0.0164, 1, 0.72, 0.7273, 975, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "endtime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " endtime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [8, 1, 0.8852, 0.0164, 1, 0.72, 0.8182, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"elapsed\", endtime - starttime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L56_C4", "label": "execute()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [8, 1, 0.918, 0.0164, 1, 0.72, 0.9091, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select count(*) from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L57_C4", "label": "print()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "vector": [8, 1, 0.9344, 0.0164, 1, 0.72, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"rows:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:If_L59_C0", "label": "if", "type": "if", "loc": [59, 60], "level": 0, "parent": null, "vector": [4, 0, 0.9754, 0.0328, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L60_C4", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_69:If_L59_C0", "vector": [8, 1, 0.9836, 0.0164, 1, 0.35, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:ImportFrom_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:For_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:For_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:For_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:For_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_69:For_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:For_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L51_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_69:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_69:Expr_L60_C4"}]
import time def yesno(question): val = raw_input(question + " ") return val.startswith("y") or val.startswith("Y") use_pysqlite2 = yesno("Use pysqlite 2.0?") if use_pysqlite2: use_custom_types = yesno("Use custom types?") use_dictcursor = yesno("Use dict cursor?") use_rowcursor = yesno("Use row cursor?") else: use_tuple = yesno("Use rowclass=tuple?") if use_pysqlite2: from pysqlite2 import dbapi2 as sqlite else: import sqlite def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d if use_pysqlite2: def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d class DictCursor(sqlite.Cursor): def __init__(self, *args, **kwargs): sqlite.Cursor.__init__(self, *args, **kwargs) self.row_factory = dict_factory class RowCursor(sqlite.Cursor): def __init__(self, *args, **kwargs): sqlite.Cursor.__init__(self, *args, **kwargs) self.row_factory = sqlite.Row def create_db(): if sqlite.version_info > (2, 0): if use_custom_types: con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES) sqlite.register_converter("text", lambda x: "<%s>" % x) else: con = sqlite.connect(":memory:") if use_dictcursor: cur = con.cursor(factory=DictCursor) elif use_rowcursor: cur = con.cursor(factory=RowCursor) else: cur = con.cursor() else: if use_tuple: con = sqlite.connect(":memory:") con.rowclass = tuple cur = con.cursor() else: con = sqlite.connect(":memory:") cur = con.cursor() cur.execute(""" create table test(v text, f float, i integer) """) return (con, cur) def test(): row = ("sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd", 3.14, 42) l = [] for i in range(1000): l.append(row) con, cur = create_db() if sqlite.version_info > (2, 0): sql = "insert into test(v, f, i) values (?, ?, ?)" else: sql = "insert into test(v, f, i) values (%s, %s, %s)" for i in range(50): cur.executemany(sql, l) cur.execute("select count(*) as cnt from test") starttime = time.time() for i in range(50): cur.execute("select v, f, i from test") l = cur.fetchall() endtime = time.time() print "elapsed:", endtime - starttime if __name__ == "__main__": test()
ajibawa-2023/Python-Code-Large/train/row_70
71
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_70:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0103, 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_70:FunctionDef_L3_C0", "label": "yesno", "type": "function", "loc": [3, 5], "level": 0, "parent": null, "vector": [2, 0, 0.0412, 0.0309, 0, 0.66, 0.1111, 796, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "yesno", "arg_names": ["question"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L4_C4", "label": "val = raw_input()", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L3_C0", "vector": [14, 1, 0.0412, 0.0103, 1, 0.87, 0.0, 618, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " val = raw_input(question + \" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L3_C0", "vector": [13, 1, 0.0515, 0.0103, 1, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L7_C0", "label": "use_pysqlite2 = yesno()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0722, 0.0103, 0, 0.66, 0.2222, 516, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_pysqlite2", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "label": "if", "type": "if", "loc": [8, 13], "level": 0, "parent": null, "vector": [4, 0, 0.1082, 0.0619, 0, 0.66, 0.3333, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n use_custom_types = yesno(\"Use custom types?\")\n use_dictcursor = yesno(\"Use dict cursor?\")\n use_rowcursor = yesno(\"Use row cursor?\")\nelse:\n use_tuple = yesno(\"Use rowclass=tuple?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L9_C4", "label": "use_custom_types = yesno()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "vector": [14, 1, 0.0928, 0.0103, 1, 0.23, 0.0, 719, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_custom_types", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_custom_types = yesno(\"Use custom types?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L10_C4", "label": "use_dictcursor = yesno()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "vector": [14, 1, 0.1031, 0.0103, 1, 0.23, 0.3333, 915, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_dictcursor", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_dictcursor = yesno(\"Use dict cursor?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L11_C4", "label": "use_rowcursor = yesno()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "vector": [14, 1, 0.1134, 0.0103, 1, 0.23, 0.6667, 606, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_rowcursor", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_rowcursor = yesno(\"Use row cursor?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L13_C4", "label": "use_tuple = yesno()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "vector": [14, 1, 0.134, 0.0103, 1, 0.23, 1.0, 310, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_tuple", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_tuple = yesno(\"Use rowclass=tuple?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L15_C0", "label": "if", "type": "if", "loc": [15, 18], "level": 0, "parent": null, "vector": [4, 0, 0.1701, 0.0412, 0, 0.66, 0.4444, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n from pysqlite2 import dbapi2 as sqlite\nelse:\n import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:ImportFrom_L16_C4", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L15_C0", "vector": [1, 1, 0.1649, 0.0103, 1, 0.86, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Import_L18_C4", "label": "sqlite import sqlite", "type": "import", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L15_C0", "vector": [1, 1, 0.1856, 0.0103, 1, 0.86, 1.0, 301, 0, 1, 0, 0, 301, 0, 0], "semantic": {"name": "sqlite", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "label": "dict_factory", "type": "function", "loc": [20, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2268, 0.0515, 0, 0.66, 0.5556, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L21_C4", "label": "d =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "vector": [14, 1, 0.2165, 0.0103, 1, 0.43, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:For_L22_C4", "label": "for idx, col", "type": "for", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "vector": [6, 1, 0.232, 0.0206, 1, 0.43, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L23_C8", "label": "assign", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L22_C4", "vector": [14, 2, 0.2371, 0.0103, 2, 0.91, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "vector": [13, 1, 0.2474, 0.0103, 1, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "label": "if", "type": "if", "loc": [26, 41], "level": 0, "parent": null, "vector": [4, 0, 0.3454, 0.1649, 0, 0.66, 0.6667, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d\n\n class DictCursor(sqlite.Cursor):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "label": "dict_factory", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "vector": [2, 1, 0.299, 0.0515, 1, 0.31, 0.0, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L28_C8", "label": "d =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "vector": [14, 2, 0.2887, 0.0103, 2, 0.6, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:For_L29_C8", "label": "for idx, col", "type": "for", "loc": [29, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "vector": [6, 2, 0.3041, 0.0206, 2, 0.6, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L30_C12", "label": "assign", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L29_C8", "vector": [14, 3, 0.3093, 0.0103, 3, 0.08, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L31_C8", "label": "return", "type": "return", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "vector": [13, 2, 0.3196, 0.0103, 2, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L33_C4", "label": "DictCursor", "type": "class", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "vector": [3, 1, 0.3557, 0.0412, 1, 0.31, 0.5, 672, 0, 1, 0, 0, 669, 0, 1], "semantic": {"name": "DictCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class DictCursor(sqlite.Cursor):\n def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8", "label": "__init__", "type": "function", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L33_C4", "vector": [2, 2, 0.3608, 0.0309, 2, 0.2, 0.0, 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 sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L35_C12", "label": "__init__()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8", "vector": [8, 3, 0.3608, 0.0103, 3, 0.47, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite.Cursor.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L36_C12", "label": "self.row_factory =", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8", "vector": [14, 3, 0.3711, 0.0103, 3, 0.47, 1.0, 832, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L38_C4", "label": "RowCursor", "type": "class", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "vector": [3, 1, 0.4072, 0.0412, 1, 0.31, 1.0, 193, 0, 1, 0, 0, 669, 0, 1], "semantic": {"name": "RowCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class RowCursor(sqlite.Cursor):\n def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8", "label": "__init__", "type": "function", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L38_C4", "vector": [2, 2, 0.4124, 0.0309, 2, 0.19, 0.0, 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 sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L40_C12", "label": "__init__()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8", "vector": [8, 3, 0.4124, 0.0103, 3, 0.03, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite.Cursor.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L41_C12", "label": "self.row_factory =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8", "vector": [14, 3, 0.4227, 0.0103, 3, 0.03, 1.0, 832, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "label": "create_db", "type": "function", "loc": [43, 67], "level": 0, "parent": null, "vector": [2, 0, 0.567, 0.2577, 0, 0.66, 0.7778, 487, 0, 0, 1, 0, 0, 0, 11], "semantic": {"name": "create_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_db():\n if sqlite.version_info > (2, 0):\n if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")\n if use_dictcursor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "label": "if", "type": "if", "loc": [44, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "vector": [4, 1, 0.5515, 0.2062, 1, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")\n if use_dictcursor:\n cur = con.cursor(factory=DictCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "label": "if", "type": "if", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "vector": [4, 2, 0.4845, 0.0515, 2, 0.37, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L46_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "vector": [14, 3, 0.4742, 0.0103, 3, 0.17, 0.0, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L47_C12", "label": "register_converter()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "vector": [8, 3, 0.4845, 0.0103, 3, 0.17, 0.5, 121, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_converter", "arg_names": [], "import_names": [], "rhs_call_name": "register_converter", "annotation": ""}, "snippet": " sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L49_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "vector": [14, 3, 0.5052, 0.0103, 3, 0.17, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8", "label": "if", "type": "if", "loc": [50, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "vector": [4, 2, 0.5412, 0.0619, 2, 0.37, 0.5, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_dictcursor:\n cur = con.cursor(factory=DictCursor)\n elif use_rowcursor:\n cur = con.cursor(factory=RowCursor)\n else:\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L51_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8", "vector": [14, 3, 0.5258, 0.0103, 3, 0.28, 0.0, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(factory=DictCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8", "vector": [4, 3, 0.5515, 0.0412, 3, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif use_rowcursor:\n cur = con.cursor(factory=RowCursor)\n else:\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L53_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8", "vector": [14, 4, 0.5464, 0.0103, 4, 0.45, 0.0, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(factory=RowCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L55_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8", "vector": [14, 4, 0.567, 0.0103, 4, 0.45, 1.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "label": "if", "type": "if", "loc": [57, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "vector": [4, 2, 0.6186, 0.0722, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_tuple:\n con = sqlite.connect(\":memory:\")\n con.rowclass = tuple\n cur = con.cursor()\n else:\n con = sqlite.connect(\":memory:\")\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L58_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "vector": [14, 3, 0.5979, 0.0103, 3, 0.85, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L59_C12", "label": "con.rowclass =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "vector": [14, 3, 0.6082, 0.0103, 3, 0.85, 0.25, 907, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.rowclass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.rowclass = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L60_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "vector": [14, 3, 0.6186, 0.0103, 3, 0.85, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L62_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "vector": [14, 3, 0.6392, 0.0103, 3, 0.85, 0.75, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L63_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "vector": [14, 3, 0.6495, 0.0103, 3, 0.85, 1.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L64_C4", "label": "execute()", "type": "expression", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "vector": [8, 1, 0.6701, 0.0309, 1, 0.43, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"\"\"\n create table test(v text, f float, i integer)\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L67_C4", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "vector": [13, 1, 0.6907, 0.0103, 1, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (con, cur)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "label": "test", "type": "function", "loc": [69, 93], "level": 0, "parent": null, "vector": [2, 0, 0.8351, 0.2577, 0, 0.66, 0.8889, 224, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)\n l = []\n for i in range(1000):\n l.append(row)\n\n con, cur = create_db()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L70_C4", "label": "row =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [14, 1, 0.7216, 0.0103, 1, 0.94, 0.0, 767, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L71_C4", "label": "l =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [14, 1, 0.732, 0.0103, 1, 0.94, 0.1, 810, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:For_L72_C4", "label": "for i", "type": "for", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [6, 1, 0.7474, 0.0206, 1, 0.94, 0.2, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1000):\n l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L73_C8", "label": "append()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L72_C4", "vector": [8, 2, 0.7526, 0.0103, 2, 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": " l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L75_C4", "label": "con, cur = create_db()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [14, 1, 0.7732, 0.0103, 1, 0.94, 0.3, 349, 3, 0, 0, 0, 487, 10, 1], "semantic": {"name": "con, cur", "arg_names": [], "import_names": [], "rhs_call_name": "create_db", "annotation": ""}, "snippet": " con, cur = create_db()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4", "label": "if", "type": "if", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [4, 1, 0.8093, 0.0412, 1, 0.94, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n sql = \"insert into test(v, f, i) values (?, ?, ?)\"\n else:\n sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L78_C8", "label": "sql =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4", "vector": [14, 2, 0.8041, 0.0103, 2, 0.73, 0.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (?, ?, ?)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L80_C8", "label": "sql =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4", "vector": [14, 2, 0.8247, 0.0103, 2, 0.73, 1.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:For_L82_C4", "label": "for i", "type": "for", "loc": [82, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [6, 1, 0.8505, 0.0206, 1, 0.94, 0.5, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L83_C8", "label": "executemany()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L82_C4", "vector": [8, 2, 0.8557, 0.0103, 2, 0.51, 0.0, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L85_C4", "label": "execute()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [8, 1, 0.8763, 0.0103, 1, 0.94, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select count(*) as cnt from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L87_C4", "label": "starttime = time()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [14, 1, 0.8969, 0.0103, 1, 0.94, 0.7, 864, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "starttime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " starttime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4", "label": "for i", "type": "for", "loc": [88, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [6, 1, 0.9175, 0.0309, 1, 0.94, 0.8, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n cur.execute(\"select v, f, i from test\")\n l = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L89_C8", "label": "execute()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4", "vector": [8, 2, 0.9175, 0.0103, 2, 0.84, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select v, f, i from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L90_C8", "label": "l = fetchall()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4", "vector": [14, 2, 0.9278, 0.0103, 2, 0.84, 1.0, 810, 3, 0, 0, 0, 133, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " l = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L91_C4", "label": "endtime = time()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [14, 1, 0.9381, 0.0103, 1, 0.94, 0.9, 975, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "endtime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " endtime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "vector": [8, 1, 0.9588, 0.0103, 1, 0.94, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"elapsed:\", endtime - starttime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:If_L95_C0", "label": "if", "type": "if", "loc": [95, 96], "level": 0, "parent": null, "vector": [4, 0, 0.9845, 0.0206, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L96_C4", "label": "test()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_70:If_L95_C0", "vector": [8, 1, 0.9897, 0.0103, 1, 0.77, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Import_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:For_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:For_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:ClassDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Return_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:For_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:For_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:For_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_70:If_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_70:Expr_L96_C4"}]
#!/usr/bin/env python from pysqlite2.test import test test()
ajibawa-2023/Python-Code-Large/train/row_71
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_71:ImportFrom_L2_C0", "label": "from pysqlite2.test import test", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 0.0, 472, 0, 1, 0, 0, 472, 0, 0], "semantic": {"name": "pysqlite2.test", "arg_names": [], "import_names": ["test"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2.test import test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_71:Expr_L3_C0", "label": "test()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.3333, 0, 0.66, 1.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": "test()"}]
[]
from pysqlite2 import dbapi2 as sqlite import os, threading def getcon(): #con = sqlite.connect("db", isolation_level=None, timeout=5.0) con = sqlite.connect(":memory:") cur = con.cursor() cur.execute("create table test(i, s)") for i in range(10): cur.execute("insert into test(i, s) values (?, 'asfd')", (i,)) con.commit() cur.close() return con def reader(what): con = getcon() while 1: cur = con.cursor() cur.execute("select i, s from test where i % 1000=?", (what,)) res = cur.fetchall() cur.close() con.close() def appender(): con = getcon() counter = 0 while 1: cur = con.cursor() cur.execute("insert into test(i, s) values (?, ?)", (counter, "foosadfasfasfsfafs")) #cur.execute("insert into test(foo) values (?)", (counter,)) counter += 1 if counter % 100 == 0: #print "appender committing", counter con.commit() cur.close() con.close() def updater(): con = getcon() counter = 0 while 1: cur = con.cursor() counter += 1 if counter % 5 == 0: cur.execute("update test set s='foo' where i % 50=0") #print "updater committing", counter con.commit() cur.close() con.close() def deleter(): con = getcon() counter = 0 while 1: cur = con.cursor() counter += 1 if counter % 5 == 0: #print "deleter committing", counter cur.execute("delete from test where i % 20=0") con.commit() cur.close() con.close() threads = [] for i in range(10): continue threads.append(threading.Thread(target=lambda: reader(i))) for i in range(5): threads.append(threading.Thread(target=appender)) #threads.append(threading.Thread(target=updater)) #threads.append(threading.Thread(target=deleter)) for t in threads: t.start()
ajibawa-2023/Python-Code-Large/train/row_72
56
80
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_72:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Import_L2_C0", "label": "os import os, threading", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.0125, 0, 0.66, 0.1, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "label": "getcon", "type": "function", "loc": [4, 13], "level": 0, "parent": null, "vector": [2, 0, 0.1062, 0.125, 0, 0.66, 0.2, 163, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "getcon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getcon():\n #con = sqlite.connect(\"db\", isolation_level=None, timeout=5.0)\n con = sqlite.connect(\":memory:\")\n cur = con.cursor()\n cur.execute(\"create table test(i, s)\")\n for i in range(10):\n cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L6_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [14, 1, 0.075, 0.0125, 1, 0.49, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L7_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [14, 1, 0.0875, 0.0125, 1, 0.49, 0.1667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L8_C4", "label": "execute()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [8, 1, 0.1, 0.0125, 1, 0.49, 0.3333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"create table test(i, s)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:For_L9_C4", "label": "for i", "type": "for", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [6, 1, 0.1187, 0.025, 1, 0.49, 0.5, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(10):\n cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L10_C8", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:For_L9_C4", "vector": [8, 2, 0.125, 0.0125, 2, 0.75, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L11_C4", "label": "commit()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [8, 1, 0.1375, 0.0125, 1, 0.49, 0.6667, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L12_C4", "label": "close()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [8, 1, 0.15, 0.0125, 1, 0.49, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "vector": [13, 1, 0.1625, 0.0125, 1, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return con"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "label": "reader", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2313, 0.1, 0, 0.66, 0.3, 548, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "reader", "arg_names": ["what"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def reader(what):\n con = getcon()\n while 1:\n cur = con.cursor()\n cur.execute(\"select i, s from test where i % 1000=?\", (what,))\n res = cur.fetchall()\n cur.close()\n con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L16_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "vector": [14, 1, 0.2, 0.0125, 1, 0.54, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "label": "while", "type": "while", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "vector": [5, 1, 0.2375, 0.0625, 1, 0.54, 0.5, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n cur.execute(\"select i, s from test where i % 1000=?\", (what,))\n res = cur.fetchall()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L18_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "vector": [14, 2, 0.225, 0.0125, 2, 0.5, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L19_C8", "label": "execute()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "vector": [8, 2, 0.2375, 0.0125, 2, 0.5, 0.3333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select i, s from test where i % 1000=?\", (what,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L20_C8", "label": "res = fetchall()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "vector": [14, 2, 0.25, 0.0125, 2, 0.5, 0.6667, 413, 3, 0, 0, 0, 133, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " res = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L21_C8", "label": "close()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "vector": [8, 2, 0.2625, 0.0125, 2, 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": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L22_C4", "label": "close()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "vector": [8, 1, 0.275, 0.0125, 1, 0.54, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "label": "appender", "type": "function", "loc": [24, 36], "level": 0, "parent": null, "vector": [2, 0, 0.375, 0.1625, 0, 0.66, 0.4, 92, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "appender", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def appender():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))\n #cur.execute(\"insert into test(foo) values (?)\", (counter,))\n counter += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L25_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "vector": [14, 1, 0.3125, 0.0125, 1, 0.13, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L26_C4", "label": "counter =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "vector": [14, 1, 0.325, 0.0125, 1, 0.13, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "label": "while", "type": "while", "loc": [27, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "vector": [5, 1, 0.3875, 0.1125, 1, 0.13, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))\n #cur.execute(\"insert into test(foo) values (?)\", (counter,))\n counter += 1\n if counter % 100 == 0:\n #print \"appender committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L28_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "vector": [14, 2, 0.35, 0.0125, 2, 0.31, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L29_C8", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "vector": [8, 2, 0.3625, 0.0125, 2, 0.31, 0.3333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:If_L32_C8", "label": "if", "type": "if", "loc": [32, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "vector": [4, 2, 0.4125, 0.0375, 2, 0.31, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 100 == 0:\n #print \"appender committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L34_C12", "label": "commit()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:If_L32_C8", "vector": [8, 3, 0.425, 0.0125, 3, 0.85, 0.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L35_C8", "label": "close()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "vector": [8, 2, 0.4375, 0.0125, 2, 0.31, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L36_C4", "label": "close()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "vector": [8, 1, 0.45, 0.0125, 1, 0.13, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "label": "updater", "type": "function", "loc": [39, 50], "level": 0, "parent": null, "vector": [2, 0, 0.5563, 0.15, 0, 0.66, 0.5, 400, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "updater", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def updater():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L40_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "vector": [14, 1, 0.5, 0.0125, 1, 0.42, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L41_C4", "label": "counter =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "vector": [14, 1, 0.5125, 0.0125, 1, 0.42, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "label": "while", "type": "while", "loc": [42, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "vector": [5, 1, 0.5687, 0.1, 1, 0.42, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")\n #print \"updater committing\", counter\n con.commit()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L43_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "vector": [14, 2, 0.5375, 0.0125, 2, 0.06, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8", "label": "if", "type": "if", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "vector": [4, 2, 0.5813, 0.05, 2, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")\n #print \"updater committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L46_C12", "label": "execute()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8", "vector": [8, 3, 0.575, 0.0125, 3, 0.64, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"update test set s='foo' where i % 50=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L48_C12", "label": "commit()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8", "vector": [8, 3, 0.6, 0.0125, 3, 0.64, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L49_C8", "label": "close()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "vector": [8, 2, 0.6125, 0.0125, 2, 0.06, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L50_C4", "label": "close()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "vector": [8, 1, 0.625, 0.0125, 1, 0.42, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "label": "deleter", "type": "function", "loc": [53, 64], "level": 0, "parent": null, "vector": [2, 0, 0.7312, 0.15, 0, 0.66, 0.6, 628, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "deleter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def deleter():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n #print \"deleter committing\", counter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L54_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "vector": [14, 1, 0.675, 0.0125, 1, 0.82, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L55_C4", "label": "counter =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "vector": [14, 1, 0.6875, 0.0125, 1, 0.82, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "label": "while", "type": "while", "loc": [56, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "vector": [5, 1, 0.7438, 0.1, 1, 0.82, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n #print \"deleter committing\", counter\n cur.execute(\"delete from test where i % 20=0\")\n con.commit()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L57_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "vector": [14, 2, 0.7125, 0.0125, 2, 0.01, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8", "label": "if", "type": "if", "loc": [59, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "vector": [4, 2, 0.7562, 0.05, 2, 0.01, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 5 == 0:\n #print \"deleter committing\", counter\n cur.execute(\"delete from test where i % 20=0\")\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L61_C12", "label": "execute()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8", "vector": [8, 3, 0.7625, 0.0125, 3, 0.05, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"delete from test where i % 20=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L62_C12", "label": "commit()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8", "vector": [8, 3, 0.775, 0.0125, 3, 0.05, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L63_C8", "label": "close()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "vector": [8, 2, 0.7875, 0.0125, 2, 0.01, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L64_C4", "label": "close()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "vector": [8, 1, 0.8, 0.0125, 1, 0.82, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L66_C0", "label": "threads =", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.825, 0.0125, 0, 0.66, 0.7, 702, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "threads = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:For_L68_C0", "label": "for i", "type": "for", "loc": [68, 70], "level": 0, "parent": null, "vector": [6, 0, 0.8625, 0.0375, 0, 0.66, 0.8, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(10):\n continue\n threads.append(threading.Thread(target=lambda: reader(i)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L70_C4", "label": "append()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:For_L68_C0", "vector": [8, 1, 0.875, 0.0125, 1, 0.36, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " threads.append(threading.Thread(target=lambda: reader(i)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:For_L72_C0", "label": "for i", "type": "for", "loc": [72, 73], "level": 0, "parent": null, "vector": [6, 0, 0.9062, 0.025, 0, 0.66, 0.9, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(5):\n threads.append(threading.Thread(target=appender))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L73_C4", "label": "append()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:For_L72_C0", "vector": [8, 1, 0.9125, 0.0125, 1, 0.04, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " threads.append(threading.Thread(target=appender))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:For_L77_C0", "label": "for t", "type": "for", "loc": [77, 78], "level": 0, "parent": null, "vector": [6, 0, 0.9688, 0.025, 0, 0.66, 1.0, 15, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for t in threads:\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L78_C4", "label": "start()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_72:For_L77_C0", "vector": [8, 1, 0.975, 0.0125, 1, 0.03, 0.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:For_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:For_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:For_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:For_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_72:For_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_72:Expr_L78_C4"}]
from __future__ import with_statement from pysqlite2 import dbapi2 as sqlite3 from datetime import datetime, timedelta import time def read_modify_write(): # Open connection and create example schema and data. # In reality, open a database file instead of an in-memory database. con = sqlite3.connect(":memory:") cur = con.cursor() cur.executescript(""" create table test(id integer primary key, data); insert into test(data) values ('foo'); insert into test(data) values ('bar'); insert into test(data) values ('baz'); """) # The read part. There are two ways for fetching data using pysqlite. # 1. "Lazy-reading" # cur.execute("select ...") # for row in cur: # ... # # Advantage: Low memory consumption, good for large resultsets, data is # fetched on demand. # Disadvantage: Database locked as long as you iterate over cursor. # # 2. "Eager reading" # cur.fetchone() to fetch one row # cur.fetchall() to fetch all rows # Advantage: Locks cleared ASAP. # Disadvantage: fetchall() may build large lists. cur.execute("select id, data from test where id=?", (2,)) row = cur.fetchone() # Stupid way to modify the data column. lst = list(row) lst[1] = lst[1] + " & more" # This is the suggested recipe to modify data using pysqlite. We use # pysqlite's proprietary API to use the connection object as a context # manager. This is equivalent to the following code: # # try: # cur.execute("...") # except: # con.rollback() # raise # finally: # con.commit() # # This makes sure locks are cleared - either by commiting or rolling back # the transaction. # # If the rollback happens because of concurrency issues, you just have to # try again until it succeeds. Much more likely is that the rollback and # the raised exception happen because of other reasons, though (constraint # violation, etc.) - don't forget to roll back on errors. # # Or use this recipe. It's useful and gets everything done in two lines of # code. with con: cur.execute("update test set data=? where id=?", (lst[1], lst[0])) def delete_older_than(): # Use detect_types if you want to use date/time types in pysqlite. con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES) cur = con.cursor() # With "DEFAULT current_timestamp" we have SQLite fill the timestamp column # automatically. cur.executescript(""" create table test(id integer primary key, data, created timestamp default current_timestamp); """) with con: for i in range(3): cur.execute("insert into test(data) values ('foo')") time.sleep(1) # Delete older than certain interval # SQLite uses UTC time, so we need to create these timestamps in Python, too. with con: delete_before = datetime.utcnow() - timedelta(seconds=2) cur.execute("delete from test where created < ?", (delete_before,)) def modify_insert(): # Use a unique index and the REPLACE command to have the "insert if not # there, but modify if it is there" pattern. Race conditions are taken care # of by transactions. con = sqlite3.connect(":memory:") cur = con.cursor() cur.executescript(""" create table test(id integer primary key, name, age); insert into test(name, age) values ('Adam', 18); insert into test(name, age) values ('Eve', 21); create unique index idx_test_data_unique on test(name); """) with con: # Make Adam age 19 cur.execute("replace into test(name, age) values ('Adam', 19)") # Create new entry cur.execute("replace into test(name, age) values ('Abel', 3)") if __name__ == "__main__": read_modify_write() delete_older_than() modify_insert()
ajibawa-2023/Python-Code-Large/train/row_74
32
110
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_74:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_names": ["with_statement"], "rhs_call_name": "", "annotation": ""}, "snippet": "from __future__ import with_statement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:ImportFrom_L2_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.1429, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:ImportFrom_L3_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0273, 0.0091, 0, 0.66, 0.2857, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Import_L4_C0", "label": "time import time", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0091, 0, 0.66, 0.4286, 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_74:FunctionDef_L6_C0", "label": "read_modify_write", "type": "function", "loc": [6, 64], "level": 0, "parent": null, "vector": [2, 0, 0.3182, 0.5364, 0, 0.66, 0.5714, 917, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "read_modify_write", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_modify_write():\n # Open connection and create example schema and data.\n # In reality, open a database file instead of an in-memory database.\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor()\n cur.executescript(\"\"\"\n create table test(id integer primary key, data);\n insert into test(data) values ('foo');"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L9_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [14, 1, 0.0818, 0.0091, 1, 0.23, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L10_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [14, 1, 0.0909, 0.0091, 1, 0.23, 0.1667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L11_C4", "label": "executescript()", "type": "expression", "loc": [11, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [8, 1, 0.1227, 0.0545, 1, 0.23, 0.3333, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, data);\n insert into test(data) values ('foo');\n insert into test(data) values ('bar');\n insert into test(data) values ('baz');\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L34_C4", "label": "execute()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [8, 1, 0.3091, 0.0091, 1, 0.23, 0.5, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select id, data from test where id=?\", (2,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L35_C4", "label": "row = fetchone()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [14, 1, 0.3182, 0.0091, 1, 0.23, 0.6667, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L38_C4", "label": "lst = list()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [14, 1, 0.3455, 0.0091, 1, 0.23, 0.8333, 564, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " lst = list(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L39_C4", "label": "assign", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [14, 1, 0.3545, 0.0091, 1, 0.23, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lst[1] = lst[1] + \" & more\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L64_C8", "label": "execute()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "vector": [8, 1, 0.5818, 0.0091, 1, 0.23, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"update test set data=? where id=?\", (lst[1], lst[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "label": "delete_older_than", "type": "function", "loc": [66, 85], "level": 0, "parent": null, "vector": [2, 0, 0.6864, 0.1818, 0, 0.66, 0.7143, 400, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "delete_older_than", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delete_older_than():\n # Use detect_types if you want to use date/time types in pysqlite.\n con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)\n cur = con.cursor()\n\n # With \"DEFAULT current_timestamp\" we have SQLite fill the timestamp column\n # automatically.\n cur.executescript(\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L68_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [14, 1, 0.6182, 0.0091, 1, 0.08, 0.0, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L69_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [14, 1, 0.6273, 0.0091, 1, 0.08, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L73_C4", "label": "executescript()", "type": "expression", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [8, 1, 0.6727, 0.0273, 1, 0.08, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, data, created timestamp default current_timestamp);\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8", "label": "for i", "type": "for", "loc": [77, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [6, 1, 0.7091, 0.0273, 1, 0.08, 0.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(3):\n cur.execute(\"insert into test(data) values ('foo')\")\n time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L78_C12", "label": "execute()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8", "vector": [8, 2, 0.7091, 0.0091, 2, 0.29, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(data) values ('foo')\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L79_C12", "label": "sleep()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8", "vector": [8, 2, 0.7182, 0.0091, 2, 0.29, 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_74:Assign_L84_C8", "label": "delete_before =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [14, 1, 0.7636, 0.0091, 1, 0.08, 0.0, 55, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete_before", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delete_before = datetime.utcnow() - timedelta(seconds=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L85_C8", "label": "execute()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "vector": [8, 1, 0.7727, 0.0091, 1, 0.08, 1.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"delete from test where created < ?\", (delete_before,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "label": "modify_insert", "type": "function", "loc": [87, 105], "level": 0, "parent": null, "vector": [2, 0, 0.8727, 0.1727, 0, 0.66, 0.8571, 298, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "modify_insert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modify_insert():\n # Use a unique index and the REPLACE command to have the \"insert if not\n # there, but modify if it is there\" pattern. Race conditions are taken care\n # of by transactions.\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor()\n cur.executescript(\"\"\"\n create table test(id integer primary key, name, age);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L91_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "vector": [14, 1, 0.8273, 0.0091, 1, 0.73, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L92_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "vector": [14, 1, 0.8364, 0.0091, 1, 0.73, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L93_C4", "label": "executescript()", "type": "expression", "loc": [93, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "vector": [8, 1, 0.8682, 0.0545, 1, 0.73, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, name, age);\n insert into test(name, age) values ('Adam', 18);\n insert into test(name, age) values ('Eve', 21);\n create unique index idx_test_data_unique on test(name);\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L102_C8", "label": "execute()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "vector": [8, 1, 0.9273, 0.0091, 1, 0.73, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"replace into test(name, age) values ('Adam', 19)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L105_C8", "label": "execute()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "vector": [8, 1, 0.9545, 0.0091, 1, 0.73, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"replace into test(name, age) values ('Abel', 3)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "label": "if", "type": "if", "loc": [107, 110], "level": 0, "parent": null, "vector": [4, 0, 0.9864, 0.0364, 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 read_modify_write()\n delete_older_than()\n modify_insert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L108_C4", "label": "read_modify_write()", "type": "expression", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "vector": [8, 1, 0.9818, 0.0091, 1, 0.96, 0.0, 917, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "read_modify_write", "arg_names": [], "import_names": [], "rhs_call_name": "read_modify_write", "annotation": ""}, "snippet": " read_modify_write()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L109_C4", "label": "delete_older_than()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "vector": [8, 1, 0.9909, 0.0091, 1, 0.96, 0.5, 400, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_older_than", "arg_names": [], "import_names": [], "rhs_call_name": "delete_older_than", "annotation": ""}, "snippet": " delete_older_than()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L110_C4", "label": "modify_insert()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "vector": [8, 1, 1.0, 0.0091, 1, 0.96, 1.0, 298, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "modify_insert", "arg_names": [], "import_names": [], "rhs_call_name": "modify_insert", "annotation": ""}, "snippet": " modify_insert()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_74:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_74:Expr_L110_C4"}]
from pysqlite2 import dbapi2 as sqlite3 Cursor = sqlite3.Cursor class EagerCursor(Cursor): def __init__(self, con): Cursor.__init__(self, con) self.rows = [] self.pos = 0 def execute(self, *args): sqlite3.Cursor.execute(self, *args) self.rows = Cursor.fetchall(self) self.pos = 0 def fetchone(self): try: row = self.rows[self.pos] self.pos += 1 return row except IndexError: return None def fetchmany(self, num=None): if num is None: num = self.arraysize result = self.rows[self.pos:self.pos+num] self.pos += num return result def fetchall(self): result = self.rows[self.pos:] self.pos = len(self.rows) return result def test(): con = sqlite3.connect(":memory:") cur = con.cursor(EagerCursor) cur.execute("create table test(foo)") cur.executemany("insert into test(foo) values (?)", [(3,), (4,), (5,)]) cur.execute("select * from test") print cur.fetchone() print cur.fetchone() print cur.fetchone() print cur.fetchone() print cur.fetchone() if __name__ == "__main__": test()
ajibawa-2023/Python-Code-Large/train/row_75
38
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_75:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L3_C0", "label": "Cursor =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0588, 0.0196, 0, 0.66, 0.25, 647, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "Cursor = sqlite3.Cursor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "label": "EagerCursor", "type": "class", "loc": [5, 35], "level": 0, "parent": null, "vector": [3, 0, 0.3922, 0.6078, 0, 0.66, 0.5, 971, 0, 5, 0, 0, 647, 0, 4], "semantic": {"name": "EagerCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EagerCursor(Cursor):\n def __init__(self, con):\n Cursor.__init__(self, con)\n self.rows = []\n self.pos = 0\n\n def execute(self, *args):\n sqlite3.Cursor.execute(self, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "vector": [2, 1, 0.1471, 0.0784, 1, 0.26, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "con"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, con):\n Cursor.__init__(self, con)\n self.rows = []\n self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L7_C8", "label": "__init__()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "vector": [8, 2, 0.1373, 0.0196, 2, 0.46, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Cursor.__init__(self, con)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L8_C8", "label": "self.rows =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "vector": [14, 2, 0.1569, 0.0196, 2, 0.46, 0.5, 881, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rows = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L9_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "vector": [14, 2, 0.1765, 0.0196, 2, 0.46, 1.0, 283, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "label": "execute", "type": "function", "loc": [11, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "vector": [2, 1, 0.2451, 0.0784, 1, 0.26, 0.25, 569, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, *args):\n sqlite3.Cursor.execute(self, *args)\n self.rows = Cursor.fetchall(self)\n self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L12_C8", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "vector": [8, 2, 0.2353, 0.0196, 2, 0.09, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " sqlite3.Cursor.execute(self, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L13_C8", "label": "self.rows = fetchall()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "vector": [14, 2, 0.2549, 0.0196, 2, 0.09, 0.5, 881, 3, 1, 0, 0, 133, 10, 1], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " self.rows = Cursor.fetchall(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L14_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "vector": [14, 2, 0.2745, 0.0196, 2, 0.09, 1.0, 283, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L16_C4", "label": "fetchone", "type": "function", "loc": [16, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "vector": [2, 1, 0.3725, 0.1373, 1, 0.26, 0.5, 561, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "fetchone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchone(self):\n try:\n row = self.rows[self.pos]\n self.pos += 1\n return row\n except IndexError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "label": "try", "type": "try", "loc": [17, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L16_C4", "vector": [7, 2, 0.3824, 0.1176, 2, 0.06, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n row = self.rows[self.pos]\n self.pos += 1\n return row\n except IndexError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L18_C12", "label": "row =", "type": "assigned_variable", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "vector": [14, 3, 0.3529, 0.0196, 3, 0.53, 0.0, 767, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = self.rows[self.pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L20_C12", "label": "return", "type": "return", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "vector": [13, 3, 0.3922, 0.0196, 3, 0.53, 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_75:Return_L22_C12", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "vector": [13, 3, 0.4314, 0.0196, 3, 0.53, 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_75:FunctionDef_L24_C4", "label": "fetchmany", "type": "function", "loc": [24, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "vector": [2, 1, 0.5294, 0.1373, 1, 0.26, 0.75, 582, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "fetchmany", "arg_names": ["self", "num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchmany(self, num=None):\n if num is None:\n num = self.arraysize\n\n result = self.rows[self.pos:self.pos+num]\n self.pos += num\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:If_L25_C8", "label": "if", "type": "if", "loc": [25, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "vector": [4, 2, 0.5, 0.0392, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if num is None:\n num = self.arraysize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L26_C12", "label": "num =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:If_L25_C8", "vector": [14, 3, 0.5098, 0.0196, 3, 0.03, 0.0, 328, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num = self.arraysize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L28_C8", "label": "result =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "vector": [14, 2, 0.549, 0.0196, 2, 0.93, 0.5, 51, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self.rows[self.pos:self.pos+num]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "vector": [13, 2, 0.5882, 0.0196, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "label": "fetchall", "type": "function", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "vector": [2, 1, 0.6569, 0.0784, 1, 0.26, 1.0, 133, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "fetchall", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchall(self):\n result = self.rows[self.pos:]\n self.pos = len(self.rows)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L33_C8", "label": "result =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "vector": [14, 2, 0.6471, 0.0196, 2, 0.95, 0.0, 51, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self.rows[self.pos:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L34_C8", "label": "self.pos = len()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "vector": [14, 2, 0.6667, 0.0196, 2, 0.95, 0.5, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(self.rows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "vector": [13, 2, 0.6863, 0.0196, 2, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "label": "test", "type": "function", "loc": [37, 47], "level": 0, "parent": null, "vector": [2, 0, 0.8235, 0.2157, 0, 0.66, 0.75, 224, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor(EagerCursor)\n cur.execute(\"create table test(foo)\")\n cur.executemany(\"insert into test(foo) values (?)\", [(3,), (4,), (5,)])\n cur.execute(\"select * from test\")\n print(cur.fetchone())\n print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L38_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [14, 1, 0.7451, 0.0196, 1, 0.77, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L39_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [14, 1, 0.7647, 0.0196, 1, 0.77, 0.1111, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(EagerCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L40_C4", "label": "execute()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.7843, 0.0196, 1, 0.77, 0.2222, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"create table test(foo)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L41_C4", "label": "executemany()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.8039, 0.0196, 1, 0.77, 0.3333, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(\"insert into test(foo) values (?)\", [(3,), (4,), (5,)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L42_C4", "label": "execute()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.8235, 0.0196, 1, 0.77, 0.4444, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select * from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L43_C4", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.8431, 0.0196, 1, 0.77, 0.5556, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L44_C4", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.8627, 0.0196, 1, 0.77, 0.6667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.8824, 0.0196, 1, 0.77, 0.7778, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L46_C4", "label": "print()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.902, 0.0196, 1, 0.77, 0.8889, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "vector": [8, 1, 0.9216, 0.0196, 1, 0.77, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:If_L49_C0", "label": "if", "type": "if", "loc": [49, 50], "level": 0, "parent": null, "vector": [4, 0, 0.9706, 0.0392, 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 test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L50_C4", "label": "test()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_75:If_L49_C0", "vector": [8, 1, 0.9804, 0.0196, 1, 0.26, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_75:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_75:Expr_L50_C4"}]
#!/usr/bin/env python # # Cross-compile and build pysqlite installers for win32 on Linux or Mac OS X. # # The way this works is very ugly, but hey, it *works*! And I didn't have to # reinvent the wheel using NSIS. import os import sys import urllib import zipfile from setup import get_amalgamation # Cross-compiler if sys.platform == "darwin": CC = "/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc" LIBDIR = "lib.macosx-10.6-i386-2.5" STRIP = "/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all" else: CC = "/usr/bin/i586-mingw32msvc-gcc" LIBDIR = "lib.linux-i686-2.5" STRIP = "strip --strip-all" # Optimization settings OPT = "-O2" # pysqlite sources + SQLite amalgamation SRC = "src/module.c src/connection.c src/cursor.c src/cache.c src/microprotocols.c src/prepare_protocol.c src/statement.c src/util.c src/row.c amalgamation/sqlite3.c" # You will need to fetch these from # https://pyext-cross.pysqlite.googlecode.com/hg/ CROSS_TOOLS = "../pysqlite-pyext-cross" def execute(cmd): print cmd return os.system(cmd) def compile_module(pyver): VER = pyver.replace(".", "") INC = "%s/python%s/include" % (CROSS_TOOLS, VER) vars = locals() vars.update(globals()) cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\"pysqlite2._sqlite\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars execute(cmd) execute("%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd" % vars) def main(): vars = locals() vars.update(globals()) get_amalgamation() for ver in ["2.5", "2.6", "2.7"]: execute("rm -rf build") # First, compile the host version. This is just to get the .py files in place. execute("python2.5 setup.py build") # Yes, now delete the host extension module. What a waste of time. os.unlink("build/%(LIBDIR)s/pysqlite2/_sqlite.so" % vars) # Cross-compile win32 extension module. compile_module(ver) # Prepare for target Python version. libdir_ver = LIBDIR[:-3] + ver os.rename("build/%(LIBDIR)s" % vars, "build/" + libdir_ver) # And create the installer! os.putenv("PYEXT_CROSS", CROSS_TOOLS) execute("python2.5 setup.py cross_bdist_wininst --skip-build --target-version=" + ver) if __name__ == "__main__": main()
ajibawa-2023/Python-Code-Large/train/row_76
41
68
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_76:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0147, 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_76:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0833, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Import_L10_C0", "label": "urllib import urllib", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 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_76:Import_L11_C0", "label": "zipfile import zipfile", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1618, 0.0147, 0, 0.66, 0.25, 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_76:ImportFrom_L13_C0", "label": "from setup import get_amalgamation", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1912, 0.0147, 0, 0.66, 0.3333, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "setup", "arg_names": [], "import_names": ["get_amalgamation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from setup import get_amalgamation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "label": "if", "type": "if", "loc": [16, 23], "level": 0, "parent": null, "vector": [4, 0, 0.2868, 0.1176, 0, 0.66, 0.4167, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if sys.platform == \"darwin\":\n CC = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc\"\n LIBDIR = \"lib.macosx-10.6-i386-2.5\"\n STRIP = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all\"\nelse:\n CC = \"/usr/bin/i586-mingw32msvc-gcc\"\n LIBDIR = \"lib.linux-i686-2.5\"\n STRIP = \"strip --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L17_C4", "label": "CC =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.25, 0.0147, 1, 0.23, 0.0, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CC = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L18_C4", "label": "LIBDIR =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.2647, 0.0147, 1, 0.23, 0.2, 88, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LIBDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LIBDIR = \"lib.macosx-10.6-i386-2.5\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L19_C4", "label": "STRIP =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.2794, 0.0147, 1, 0.23, 0.4, 442, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STRIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " STRIP = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L21_C4", "label": "CC =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.3088, 0.0147, 1, 0.23, 0.6, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CC = \"/usr/bin/i586-mingw32msvc-gcc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L22_C4", "label": "LIBDIR =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.3235, 0.0147, 1, 0.23, 0.8, 88, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LIBDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LIBDIR = \"lib.linux-i686-2.5\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L23_C4", "label": "STRIP =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "vector": [14, 1, 0.3382, 0.0147, 1, 0.23, 1.0, 442, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STRIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " STRIP = \"strip --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L26_C0", "label": "OPT =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.3824, 0.0147, 0, 0.66, 0.5, 67, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "OPT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OPT = \"-O2\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L29_C0", "label": "SRC =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.4265, 0.0147, 0, 0.66, 0.5833, 454, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SRC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SRC = \"src/module.c src/connection.c src/cursor.c src/cache.c src/microprotocols.c src/prepare_protocol.c src/statement.c src/util.c src/row.c amalgamation/sqlite3.c\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L33_C0", "label": "CROSS_TOOLS =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4853, 0.0147, 0, 0.66, 0.6667, 496, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CROSS_TOOLS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CROSS_TOOLS = \"../pysqlite-pyext-cross\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L35_C0", "label": "execute", "type": "function", "loc": [35, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5294, 0.0441, 0, 0.66, 0.75, 569, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": ["cmd"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def execute(cmd):\n print(cmd)\n return os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L36_C4", "label": "print()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L35_C0", "vector": [8, 1, 0.5294, 0.0147, 1, 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(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L35_C0", "vector": [13, 1, 0.5441, 0.0147, 1, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "label": "compile_module", "type": "function", "loc": [39, 46], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.1176, 0, 0.66, 0.8333, 61, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "compile_module", "arg_names": ["pyver"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compile_module(pyver):\n VER = pyver.replace(\".\", \"\")\n INC = \"%s/python%s/include\" % (CROSS_TOOLS, VER)\n vars = locals()\n vars.update(globals())\n cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\\\\"pysqlite2._sqlite\\\\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars\n execute(cmd)\n execute(\"%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L40_C4", "label": "VER = replace()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [14, 1, 0.5882, 0.0147, 1, 0.99, 0.0, 709, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "VER", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " VER = pyver.replace(\".\", \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L41_C4", "label": "INC =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [14, 1, 0.6029, 0.0147, 1, 0.99, 0.1667, 299, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "INC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INC = \"%s/python%s/include\" % (CROSS_TOOLS, VER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L42_C4", "label": "vars = locals()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [14, 1, 0.6176, 0.0147, 1, 0.99, 0.3333, 302, 3, 0, 0, 0, 853, 10, 1], "semantic": {"name": "vars", "arg_names": [], "import_names": [], "rhs_call_name": "locals", "annotation": ""}, "snippet": " vars = locals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L43_C4", "label": "update()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [8, 1, 0.6324, 0.0147, 1, 0.99, 0.5, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " vars.update(globals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L44_C4", "label": "cmd =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [14, 1, 0.6471, 0.0147, 1, 0.99, 0.6667, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\\\\"pysqlite2._sqlite\\\\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L45_C4", "label": "execute()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [8, 1, 0.6618, 0.0147, 1, 0.99, 0.8333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L46_C4", "label": "execute()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "vector": [8, 1, 0.6765, 0.0147, 1, 0.99, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 65], "level": 0, "parent": null, "vector": [2, 0, 0.8309, 0.2647, 0, 0.66, 0.9167, 624, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n vars = locals()\n vars.update(globals())\n get_amalgamation()\n for ver in [\"2.5\", \"2.6\", \"2.7\"]:\n execute(\"rm -rf build\")\n # First, compile the host version. This is just to get the .py files in place.\n execute(\"python2.5 setup.py build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L49_C4", "label": "vars = locals()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "vector": [14, 1, 0.7206, 0.0147, 1, 0.71, 0.0, 302, 3, 0, 0, 0, 853, 10, 1], "semantic": {"name": "vars", "arg_names": [], "import_names": [], "rhs_call_name": "locals", "annotation": ""}, "snippet": " vars = locals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L50_C4", "label": "update()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "vector": [8, 1, 0.7353, 0.0147, 1, 0.71, 0.3333, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " vars.update(globals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L51_C4", "label": "get_amalgamation()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "vector": [8, 1, 0.75, 0.0147, 1, 0.71, 0.6667, 216, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get_amalgamation", "arg_names": [], "import_names": [], "rhs_call_name": "get_amalgamation", "annotation": ""}, "snippet": " get_amalgamation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "label": "for ver", "type": "for", "loc": [52, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "vector": [6, 1, 0.8603, 0.2059, 1, 0.71, 1.0, 648, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "ver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ver in [\"2.5\", \"2.6\", \"2.7\"]:\n execute(\"rm -rf build\")\n # First, compile the host version. This is just to get the .py files in place.\n execute(\"python2.5 setup.py build\")\n # Yes, now delete the host extension module. What a waste of time.\n os.unlink(\"build/%(LIBDIR)s/pysqlite2/_sqlite.so\" % vars)\n # Cross-compile win32 extension module.\n compile_module(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L53_C8", "label": "execute()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.7794, 0.0147, 2, 0.68, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"rm -rf build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L55_C8", "label": "execute()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.8088, 0.0147, 2, 0.68, 0.1429, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"python2.5 setup.py build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L57_C8", "label": "unlink()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.8382, 0.0147, 2, 0.68, 0.2857, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " os.unlink(\"build/%(LIBDIR)s/pysqlite2/_sqlite.so\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L59_C8", "label": "compile_module()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.8676, 0.0147, 2, 0.68, 0.4286, 61, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "compile_module", "arg_names": [], "import_names": [], "rhs_call_name": "compile_module", "annotation": ""}, "snippet": " compile_module(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L61_C8", "label": "libdir_ver =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [14, 2, 0.8971, 0.0147, 2, 0.68, 0.5714, 837, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "libdir_ver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " libdir_ver = LIBDIR[:-3] + ver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L62_C8", "label": "rename()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.9118, 0.0147, 2, 0.68, 0.7143, 508, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "rename", "arg_names": [], "import_names": [], "rhs_call_name": "rename", "annotation": ""}, "snippet": " os.rename(\"build/%(LIBDIR)s\" % vars, \"build/\" + libdir_ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L64_C8", "label": "putenv()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.9412, 0.0147, 2, 0.68, 0.8571, 815, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "putenv", "arg_names": [], "import_names": [], "rhs_call_name": "putenv", "annotation": ""}, "snippet": " os.putenv(\"PYEXT_CROSS\", CROSS_TOOLS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L65_C8", "label": "execute()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "vector": [8, 2, 0.9559, 0.0147, 2, 0.68, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"python2.5 setup.py cross_bdist_wininst --skip-build --target-version=\" + ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L68_C4", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_76:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 1, 0.89, 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_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_76:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_76:Expr_L68_C4"}]
# -*- coding: utf-8 -*- # # pysqlite documentation build configuration file, created by # sphinx-quickstart.py on Sat Mar 22 02:47:54 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleable (module imports are okay, they're removed automatically). # # All configuration values have a default value; values that are commented out # serve to show the default value. import sys # If your extensions are in another directory, add it here. #sys.path.append('some/directory') # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.addons.*') or your custom ones. #extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'pysqlite' copyright = u'2008-2009, Gerhard Häring' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. version = '2.6' # The full version, including alpha/beta/rc tags. release = '2.6.0' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # Options for HTML output # ----------------------- # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. html_style = 'default.css' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['.static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Content template for the index page. #html_index = '' # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If true, the reST sources are included in the HTML build as _sources/<name>. #html_copy_source = True # Output file base name for HTML help builder. htmlhelp_basename = 'pysqlitedoc' # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). #latex_documents = [] # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True
ajibawa-2023/Python-Code-Large/train/row_77
14
132
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_77:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1061, 0.0076, 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_77:Assign_L27_C0", "label": "templates_path =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.2045, 0.0076, 0, 0.66, 0.0769, 518, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "templates_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "templates_path = ['.templates']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L30_C0", "label": "source_suffix =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.2273, 0.0076, 0, 0.66, 0.1538, 462, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "source_suffix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "source_suffix = '.rst'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L33_C0", "label": "master_doc =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0076, 0, 0.66, 0.2308, 389, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "master_doc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "master_doc = 'index'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L36_C0", "label": "project =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0076, 0, 0.66, 0.3077, 841, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "project", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "project = 'pysqlite'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L37_C0", "label": "copyright =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.2803, 0.0076, 0, 0.66, 0.3846, 928, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "copyright", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "copyright = u'2008-2009, Gerhard H\u00e4ring'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L43_C0", "label": "version =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.3258, 0.0076, 0, 0.66, 0.4615, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = '2.6'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L45_C0", "label": "release =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.3409, 0.0076, 0, 0.66, 0.5385, 784, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "release = '2.6.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L51_C0", "label": "today_fmt =", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.3864, 0.0076, 0, 0.66, 0.6154, 820, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "today_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "today_fmt = '%B %d, %Y'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L68_C0", "label": "pygments_style =", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.5152, 0.0076, 0, 0.66, 0.6923, 745, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pygments_style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pygments_style = 'sphinx'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L77_C0", "label": "html_style =", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0076, 0, 0.66, 0.7692, 262, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html_style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_style = 'default.css'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L82_C0", "label": "html_static_path =", "type": "assigned_variable", "loc": [82, 82], "level": 0, "parent": null, "vector": [14, 0, 0.6212, 0.0076, 0, 0.66, 0.8462, 979, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "html_static_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_static_path = ['.static']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L86_C0", "label": "html_last_updated_fmt =", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.6515, 0.0076, 0, 0.66, 0.9231, 587, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html_last_updated_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_last_updated_fmt = '%b %d, %Y'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_77:Assign_L109_C0", "label": "htmlhelp_basename =", "type": "assigned_variable", "loc": [109, 109], "level": 0, "parent": null, "vector": [14, 0, 0.8258, 0.0076, 0, 0.66, 1.0, 14, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "htmlhelp_basename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "htmlhelp_basename = 'pysqlitedoc'"}]
[]
from pysqlite2 import dbapi2 as sqlite3 FIELD_MAX_WIDTH = 20 TABLE_NAME = 'people' SELECT = 'select * from %s order by age, name_last' % TABLE_NAME con = sqlite3.connect("mydb") cur = con.cursor() cur.execute(SELECT) # Print a header. for fieldDesc in cur.description: print fieldDesc[0].ljust(FIELD_MAX_WIDTH) , print # Finish the header with a newline. print '-' * 78 # For each row, print the value of each field left-justified within # the maximum possible width of that field. fieldIndices = range(len(cur.description)) for row in cur: for fieldIndex in fieldIndices: fieldValue = str(row[fieldIndex]) print fieldValue.ljust(FIELD_MAX_WIDTH) , print # Finish the row with a newline.
ajibawa-2023/Python-Code-Large/train/row_78
1
2
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_78:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}]
[]
from pysqlite2 import dbapi2 as sqlite3 def progress(): print "Query still executing. Please wait ..." con = sqlite3.connect(":memory:") con.execute("create table test(x)") # Let's create some data con.executemany("insert into test(x) values (?)", [(x,) for x in xrange(300)]) # A progress handler, executed every 10 million opcodes con.set_progress_handler(progress, 10000000) # A particularly long-running query killer_stament = """ select count(*) from ( select t1.x from test t1, test t2, test t3 ) """ con.execute(killer_stament) print "-" * 50 # Clear the progress handler con.set_progress_handler(None, 0) con.execute(killer_stament)
ajibawa-2023/Python-Code-Large/train/row_79
12
29
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_79:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:FunctionDef_L3_C0", "label": "progress", "type": "function", "loc": [3, 4], "level": 0, "parent": null, "vector": [2, 0, 0.1207, 0.069, 0, 0.66, 0.1, 82, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def progress():\n print(\"Query still executing. Please wait ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L4_C4", "label": "print()", "type": "expression", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_79:FunctionDef_L3_C0", "vector": [8, 1, 0.1379, 0.0345, 1, 0.68, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Query still executing. Please wait ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Assign_L6_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.2069, 0.0345, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.0345, 0, 0.66, 0.3, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table test(x)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L10_C0", "label": "executemany()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.3448, 0.0345, 0, 0.66, 0.4, 175, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "con.executemany(\"insert into test(x) values (?)\", [(x,) for x in xrange(300)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L13_C0", "label": "set_progress_handler()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.4483, 0.0345, 0, 0.66, 0.5, 301, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_progress_handler", "arg_names": [], "import_names": [], "rhs_call_name": "set_progress_handler", "annotation": ""}, "snippet": "con.set_progress_handler(progress, 10000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Assign_L16_C0", "label": "killer_stament =", "type": "assigned_variable", "loc": [16, 20], "level": 0, "parent": null, "vector": [14, 0, 0.6207, 0.1724, 0, 0.66, 0.6, 804, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "killer_stament", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "killer_stament = \"\"\"\n select count(*) from (\n select t1.x from test t1, test t2, test t3\n )\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L22_C0", "label": "execute()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.7586, 0.0345, 0, 0.66, 0.7, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(killer_stament)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L23_C0", "label": "print()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.7931, 0.0345, 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(\"-\" * 50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L26_C0", "label": "set_progress_handler()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.8966, 0.0345, 0, 0.66, 0.9, 301, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_progress_handler", "arg_names": [], "import_names": [], "rhs_call_name": "set_progress_handler", "annotation": ""}, "snippet": "con.set_progress_handler(None, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L28_C0", "label": "execute()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.9655, 0.0345, 0, 0.66, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(killer_stament)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_79:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_79:Expr_L4_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() SELECT = "select name_last, age from people order by age, name_last" # 1. Iterate over the rows available from the cursor, unpacking the # resulting sequences to yield their elements (name_last, age): cur.execute(SELECT) for (name_last, age) in cur: print '%s is %d years old.' % (name_last, age) # 2. Equivalently: cur.execute(SELECT) for row in cur: print '%s is %d years old.' % (row[0], row[1])
ajibawa-2023/Python-Code-Large/train/row_80
10
17
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_80:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1765, 0.0588, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2941, 0.0588, 0, 0.66, 0.2857, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Assign_L6_C0", "label": "SELECT =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.3529, 0.0588, 0, 0.66, 0.4286, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SELECT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SELECT = \"select name_last, age from people order by age, name_last\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.5882, 0.0588, 0, 0.66, 0.5714, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(SELECT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:For_L11_C0", "label": "for name_last, age", "type": "for", "loc": [11, 12], "level": 0, "parent": null, "vector": [6, 0, 0.6765, 0.1176, 0, 0.66, 0.7143, 234, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name_last, age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for (name_last, age) in cur:\n print('%s is %d years old.' % (name_last, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L12_C4", "label": "print()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_80:For_L11_C0", "vector": [8, 1, 0.7059, 0.0588, 1, 0.76, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is %d years old.' % (name_last, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L15_C0", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.8824, 0.0588, 0, 0.66, 0.8571, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(SELECT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:For_L16_C0", "label": "for row", "type": "for", "loc": [16, 17], "level": 0, "parent": null, "vector": [6, 0, 0.9706, 0.1176, 0, 0.66, 1.0, 767, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n print('%s is %d years old.' % (row[0], row[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_80:For_L16_C0", "vector": [8, 1, 1.0, 0.0588, 1, 0.91, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is %d years old.' % (row[0], row[1]))"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_80:For_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_80:For_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_80:Expr_L17_C4"}]
from pysqlite2 import dbapi2 as sqlite3 # Create a connection to the database file "mydb": con = sqlite3.connect("mydb") # Get a Cursor object that operates in the context of Connection con: cur = con.cursor() # Execute the SELECT statement: cur.execute("select * from people order by age") # Retrieve all rows as a sequence and print that sequence: print cur.fetchall()
ajibawa-2023/Python-Code-Large/train/row_81
5
13
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_81:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_81:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3077, 0.0769, 0, 0.66, 0.25, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_81:Assign_L7_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5385, 0.0769, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_81:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.7692, 0.0769, 0, 0.66, 0.75, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select * from people order by age\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_81:Expr_L13_C0", "label": "print()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0769, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}]
[]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb")
ajibawa-2023/Python-Code-Large/train/row_82
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_82:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_82:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.3333, 0, 0.66, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}]
[]
from pysqlite2 import dbapi2 as sqlite3 class MySum: def __init__(self): self.count = 0 def step(self, value): self.count += value def finalize(self): return self.count con = sqlite3.connect(":memory:") con.create_aggregate("mysum", 1, MySum) cur = con.cursor() cur.execute("create table test(i)") cur.execute("insert into test(i) values (1)") cur.execute("insert into test(i) values (2)") cur.execute("select mysum(i) from test") print cur.fetchone()[0]
ajibawa-2023/Python-Code-Large/train/row_83
15
20
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_83:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "label": "MySum", "type": "class", "loc": [3, 11], "level": 0, "parent": null, "vector": [3, 0, 0.35, 0.45, 0, 0.66, 0.1111, 865, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "MySum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MySum:\n def __init__(self):\n self.count = 0\n\n def step(self, value):\n self.count += value\n\n def finalize(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "vector": [2, 1, 0.225, 0.1, 1, 0.23, 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.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Assign_L5_C8", "label": "self.count =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L4_C4", "vector": [14, 2, 0.25, 0.05, 2, 0.39, 0.0, 340, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L7_C4", "label": "step", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "vector": [2, 1, 0.375, 0.1, 1, 0.23, 0.5, 880, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "step", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def step(self, value):\n self.count += value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L10_C4", "label": "finalize", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "vector": [2, 1, 0.525, 0.1, 1, 0.23, 1.0, 716, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "finalize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def finalize(self):\n return self.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L10_C4", "vector": [13, 2, 0.55, 0.05, 2, 0.54, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Assign_L13_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.65, 0.05, 0, 0.66, 0.2222, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L14_C0", "label": "create_aggregate()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.05, 0, 0.66, 0.3333, 843, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_aggregate", "arg_names": [], "import_names": [], "rhs_call_name": "create_aggregate", "annotation": ""}, "snippet": "con.create_aggregate(\"mysum\", 1, MySum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Assign_L15_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.05, 0, 0.66, 0.4444, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L16_C0", "label": "execute()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.05, 0, 0.66, 0.5556, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(i)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L17_C0", "label": "execute()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.85, 0.05, 0, 0.66, 0.6667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(i) values (1)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.9, 0.05, 0, 0.66, 0.7778, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(i) values (2)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L19_C0", "label": "execute()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.95, 0.05, 0, 0.66, 0.8889, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select mysum(i) from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_83:Expr_L20_C0", "label": "print()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.05, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83:Return_L11_C8"}]
# A minimal SQLite shell for experiments from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") con.isolation_level = None cur = con.cursor() buffer = "" print "Enter your SQL commands to execute in SQLite." print "Enter a blank line to exit." while True: line = raw_input() if line == "": break buffer += line if sqlite3.complete_statement(buffer): try: buffer = buffer.strip() cur.execute(buffer) if buffer.lstrip().upper().startswith("SELECT"): print cur.fetchall() except sqlite3.Error, e: print "An error occurred:", e.args[0] buffer = "" con.close()
ajibawa-2023/Python-Code-Large/train/row_84
1
2
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_84:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}]
[]
from pysqlite2 import dbapi2 as sqlite3 def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d con = sqlite3.connect(":memory:") con.row_factory = dict_factory cur = con.cursor() cur.execute("select 1 as a") print cur.fetchone()["a"]
ajibawa-2023/Python-Code-Large/train/row_85
11
13
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_85:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "label": "dict_factory", "type": "function", "loc": [3, 7], "level": 0, "parent": null, "vector": [2, 0, 0.3846, 0.3846, 0, 0.66, 0.1667, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L4_C4", "label": "d =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "vector": [14, 1, 0.3077, 0.0769, 1, 0.2, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:For_L5_C4", "label": "for idx, col", "type": "for", "loc": [5, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "vector": [6, 1, 0.4231, 0.1538, 1, 0.2, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L6_C8", "label": "assign", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_85:For_L5_C4", "vector": [14, 2, 0.4615, 0.0769, 2, 0.47, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Return_L7_C4", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "vector": [13, 1, 0.5385, 0.0769, 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 d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L9_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6923, 0.0769, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L10_C0", "label": "con.row_factory =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.7692, 0.0769, 0, 0.66, 0.5, 721, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L11_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.8462, 0.0769, 0, 0.66, 0.6667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.9231, 0.0769, 0, 0.66, 0.8333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select 1 as a\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_85:Expr_L13_C0", "label": "print()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0769, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[\"a\"])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85:For_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85:Return_L7_C4"}]
from pysqlite2 import dbapi2 as sqlite3 import datetime con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) cur = con.cursor() cur.execute("create table test(d date, ts timestamp)") today = datetime.date.today() now = datetime.datetime.now() cur.execute("insert into test(d, ts) values (?, ?)", (today, now)) cur.execute("select d, ts from test") row = cur.fetchone() print today, "=>", row[0], type(row[0]) print now, "=>", row[1], type(row[1]) cur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"') row = cur.fetchone() print "current_date", row[0], type(row[0]) print "current_timestamp", row[1], type(row[1])
ajibawa-2023/Python-Code-Large/train/row_86
16
20
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_86:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Import_L2_C0", "label": "datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.05, 0, 0.66, 0.0667, 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_86:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2, 0.05, 0, 0.66, 0.1333, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.05, 0, 0.66, 0.2, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L6_C0", "label": "execute()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.05, 0, 0.66, 0.2667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(d date, ts timestamp)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Assign_L8_C0", "label": "today = today()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.4, 0.05, 0, 0.66, 0.3333, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": "today = datetime.date.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Assign_L9_C0", "label": "now = now()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.45, 0.05, 0, 0.66, 0.4, 894, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": "now = datetime.datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L11_C0", "label": "execute()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.55, 0.05, 0, 0.66, 0.4667, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(d, ts) values (?, ?)\", (today, now))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.6, 0.05, 0, 0.66, 0.5333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select d, ts from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Assign_L13_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.65, 0.05, 0, 0.66, 0.6, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L14_C0", "label": "print()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.05, 0, 0.66, 0.6667, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(today, \"=>\", row[0], type(row[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.05, 0, 0.66, 0.7333, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(now, \"=>\", row[1], type(row[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L17_C0", "label": "execute()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.85, 0.05, 0, 0.66, 0.8, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select current_date as \"d [date]\", current_timestamp as \"ts [timestamp]\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Assign_L18_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.9, 0.05, 0, 0.66, 0.8667, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L19_C0", "label": "print()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.95, 0.05, 0, 0.66, 0.9333, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"current_date\", row[0], type(row[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_86:Expr_L20_C0", "label": "print()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.05, 0, 0.66, 1.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"current_timestamp\", row[1], type(row[1]))"}]
[]
from pysqlite2 import dbapi2 as sqlite3 def authorizer_callback(action, arg1, arg2, dbname, source): if action != sqlite3.SQLITE_SELECT: return sqlite3.SQLITE_DENY if arg1 == "private_table": return sqlite3.SQLITE_DENY return sqlite3.SQLITE_OK con = sqlite3.connect(":memory:") con.executescript(""" create table public_table(c1, c2); create table private_table(c1, c2); """) con.set_authorizer(authorizer_callback) try: con.execute("select * from private_table") except sqlite3.DatabaseError, e: print "SELECT FROM private_table =>", e.args[0] # access ... prohibited try: con.execute("insert into public_table(c1, c2) values (1, 2)") except sqlite3.DatabaseError, e: print "DML command =>", e.args[0] # access ... prohibited
ajibawa-2023/Python-Code-Large/train/row_87
7
9
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_87:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "label": "authorizer_callback", "type": "function", "loc": [3, 8], "level": 0, "parent": null, "vector": [2, 0, 0.6111, 0.6667, 0, 0.66, 1.0, 423, 0, 5, 1, 0, 0, 0, 0], "semantic": {"name": "authorizer_callback", "arg_names": ["action", "arg1", "arg2", "dbname", "source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def authorizer_callback(action, arg1, arg2, dbname, source):\n if action != sqlite3.SQLITE_SELECT:\n return sqlite3.SQLITE_DENY\n if arg1 == \"private_table\":\n return sqlite3.SQLITE_DENY\n return sqlite3.SQLITE_OK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:If_L4_C4", "label": "if", "type": "if", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "vector": [4, 1, 0.5, 0.2222, 1, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if action != sqlite3.SQLITE_SELECT:\n return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L5_C8", "label": "return", "type": "return", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_87:If_L4_C4", "vector": [13, 2, 0.5556, 0.1111, 2, 0.4, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:If_L6_C4", "label": "if", "type": "if", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "vector": [4, 1, 0.7222, 0.2222, 1, 0.03, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if arg1 == \"private_table\":\n return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L7_C8", "label": "return", "type": "return", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_87:If_L6_C4", "vector": [13, 2, 0.7778, 0.1111, 2, 0.19, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L8_C4", "label": "return", "type": "return", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "vector": [13, 1, 0.8889, 0.1111, 1, 0.03, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_OK"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_87:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_87:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_87:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_87:If_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_87:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_87:Return_L8_C4"}]
from pysqlite2 import dbapi2 as sqlite3 # The shared cache is only available in SQLite versions 3.3.3 or later # See the SQLite documentaton for details. sqlite3.enable_shared_cache(True)
ajibawa-2023/Python-Code-Large/train/row_88
2
6
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_88:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_88:Expr_L6_C0", "label": "enable_shared_cache()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.1667, 0, 0.66, 1.0, 965, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_shared_cache", "arg_names": [], "import_names": [], "rhs_call_name": "enable_shared_cache", "annotation": ""}, "snippet": "sqlite3.enable_shared_cache(True)"}]
[]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:")
ajibawa-2023/Python-Code-Large/train/row_89
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_89:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_89:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.3333, 0, 0.66, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}]
[]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=? and age=?", (who, age)) print cur.fetchone()
ajibawa-2023/Python-Code-Large/train/row_90
7
11
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_90:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0909, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4545, 0.0909, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0909, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.7273, 0.0909, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=? and age=?\", (who, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_90:Expr_L11_C0", "label": "print()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}]
[]
from __future__ import with_statement from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") con.execute("create table person (id integer primary key, firstname varchar unique)") # Successful, con.commit() is called automatically afterwards with con: con.execute("insert into person(firstname) values (?)", ("Joe",)) # con.rollback() is called after the with block finishes with an exception, the # exception is still raised and must be catched try: with con: con.execute("insert into person(firstname) values (?)", ("Joe",)) except sqlite3.IntegrityError: print "couldn't add Joe twice"
ajibawa-2023/Python-Code-Large/train/row_91
8
19
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_91:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_names": ["with_statement"], "rhs_call_name": "", "annotation": ""}, "snippet": "from __future__ import with_statement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:ImportFrom_L2_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.25, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2105, 0.0526, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L5_C0", "label": "execute()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2632, 0.0526, 0, 0.66, 0.75, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person (id integer primary key, firstname varchar unique)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L9_C4", "label": "execute()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.4737, 0.0526, 0, 0.66, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Try_L13_C0", "label": "try", "type": "try", "loc": [13, 17], "level": 0, "parent": null, "vector": [7, 0, 0.7895, 0.2632, 0, 0.66, 1.25, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n with con:\n con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))\nexcept sqlite3.IntegrityError:\n print(\"couldn't add Joe twice\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L15_C8", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_91:Try_L13_C0", "vector": [8, 1, 0.7895, 0.0526, 1, 0.16, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_91:Try_L13_C0", "vector": [8, 1, 0.8947, 0.0526, 1, 0.16, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"couldn't add Joe twice\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_91:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_91:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_91:Expr_L17_C4"}]
from pysqlite2 import dbapi2 as sqlite3 import md5 def md5sum(t): return md5.md5(t).hexdigest() con = sqlite3.connect(":memory:") con.create_function("md5", 1, md5sum) cur = con.cursor() cur.execute("select md5(?)", ("foo",)) print cur.fetchone()[0]
ajibawa-2023/Python-Code-Large/train/row_92
9
11
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_92:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Import_L2_C0", "label": "md5 import md5", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.1429, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "md5", "arg_names": [], "import_names": ["md5"], "rhs_call_name": "", "annotation": ""}, "snippet": "import md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:FunctionDef_L4_C0", "label": "md5sum", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.4091, 0.1818, 0, 0.66, 0.2857, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "md5sum", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def md5sum(t):\n return md5.md5(t).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_92:FunctionDef_L4_C0", "vector": [13, 1, 0.4545, 0.0909, 1, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return md5.md5(t).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Assign_L7_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0909, 0, 0.66, 0.4286, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Expr_L8_C0", "label": "create_function()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.7273, 0.0909, 0, 0.66, 0.5714, 567, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_function", "arg_names": [], "import_names": [], "rhs_call_name": "create_function", "annotation": ""}, "snippet": "con.create_function(\"md5\", 1, md5sum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.0909, 0, 0.66, 0.7143, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8571, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select md5(?)\", (\"foo\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_92:Expr_L11_C0", "label": "print()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_92:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_92:Return_L5_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") con.row_factory = sqlite3.Row cur = con.cursor() cur.execute("select name_last, age from people") for row in cur: assert row[0] == row["name_last"] assert row["name_last"] == row["nAmE_lAsT"] assert row[1] == row["age"] assert row[1] == row["AgE"]
ajibawa-2023/Python-Code-Large/train/row_93
6
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_93:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_93:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_93:Assign_L4_C0", "label": "con.row_factory =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.4, 721, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.row_factory = sqlite3.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_93:Assign_L6_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0833, 0, 0.66, 0.6, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_93:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5833, 0.0833, 0, 0.66, 0.8, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_93:For_L8_C0", "label": "for row", "type": "for", "loc": [8, 12], "level": 0, "parent": null, "vector": [6, 0, 0.8333, 0.4167, 0, 0.66, 1.0, 767, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n assert row[0] == row[\"name_last\"]\n assert row[\"name_last\"] == row[\"nAmE_lAsT\"]\n assert row[1] == row[\"age\"]\n assert row[1] == row[\"AgE\"]"}]
[]
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def adapt_point(point): return "%f;%f" % (point.x, point.y) sqlite3.register_adapter(Point, adapt_point) con = sqlite3.connect(":memory:") cur = con.cursor() p = Point(4.0, -3.2) cur.execute("select ?", (p,)) print cur.fetchone()[0]
ajibawa-2023/Python-Code-Large/train/row_94
12
17
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_94:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 5], "level": 0, "parent": null, "vector": [3, 0, 0.2353, 0.1765, 0, 0.66, 0.125, 652, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_94:ClassDef_L3_C0", "vector": [2, 1, 0.2647, 0.1176, 1, 0.68, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L4_C4", "vector": [14, 2, 0.2941, 0.0588, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L7_C0", "label": "adapt_point", "type": "function", "loc": [7, 8], "level": 0, "parent": null, "vector": [2, 0, 0.4412, 0.1176, 0, 0.66, 0.25, 704, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "adapt_point", "arg_names": ["point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_point(point):\n return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Return_L8_C4", "label": "return", "type": "return", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L7_C0", "vector": [13, 1, 0.4706, 0.0588, 1, 0.84, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Expr_L10_C0", "label": "register_adapter()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.5882, 0.0588, 0, 0.66, 0.375, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(Point, adapt_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.7059, 0.0588, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Assign_L13_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.7647, 0.0588, 0, 0.66, 0.625, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Assign_L15_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.8824, 0.0588, 0, 0.66, 0.75, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Expr_L16_C0", "label": "execute()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.9412, 0.0588, 0, 0.66, 0.875, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_94:Expr_L17_C0", "label": "print()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0588, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_94:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_94:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_94:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_94:Return_L8_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() # Create the table con.execute("create table person(lastname, firstname)") AUSTRIA = u"\xd6sterreich" # by default, rows are returned as Unicode cur.execute("select ?", (AUSTRIA,)) row = cur.fetchone() assert row[0] == AUSTRIA # but we can make pysqlite always return bytestrings ... con.text_factory = str cur.execute("select ?", (AUSTRIA,)) row = cur.fetchone() assert type(row[0]) == str # the bytestrings will be encoded in UTF-8, unless you stored garbage in the # database ... assert row[0] == AUSTRIA.encode("utf-8") # we can also implement a custom text_factory ... # here we implement one that will ignore Unicode characters that cannot be # decoded from UTF-8 con.text_factory = lambda x: unicode(x, "utf-8", "ignore") cur.execute("select ?", ("this is latin1 and would normally create errors" + u"\xe4\xf6\xfc".encode("latin1"),)) row = cur.fetchone() assert type(row[0]) == unicode # pysqlite offers a builtin optimized text_factory that will return bytestring # objects, if the data is in ASCII only, and otherwise return unicode objects con.text_factory = sqlite3.OptimizedUnicode cur.execute("select ?", (AUSTRIA,)) row = cur.fetchone() assert type(row[0]) == unicode cur.execute("select ?", ("Germany",)) row = cur.fetchone() assert type(row[0]) == str
ajibawa-2023/Python-Code-Large/train/row_95
18
42
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_95:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0238, 0, 0.66, 0.0588, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L4_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0952, 0.0238, 0, 0.66, 0.1176, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.0238, 0, 0.66, 0.1765, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person(lastname, firstname)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L9_C0", "label": "AUSTRIA =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.2143, 0.0238, 0, 0.66, 0.2353, 918, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUSTRIA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUSTRIA = u\"\\xd6sterreich\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.2857, 0.0238, 0, 0.66, 0.2941, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L13_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3095, 0.0238, 0, 0.66, 0.3529, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L17_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.4048, 0.0238, 0, 0.66, 0.4706, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4286, 0.0238, 0, 0.66, 0.5294, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L19_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.4524, 0.0238, 0, 0.66, 0.5882, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L28_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0238, 0, 0.66, 0.7647, 979, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = lambda x: unicode(x, \"utf-8\", \"ignore\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L29_C0", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.6905, 0.0238, 0, 0.66, 0.8235, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (\"this is latin1 and would normally create errors\" + u\"\\xe4\\xf6\\xfc\".encode(\"latin1\"),))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L30_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.0238, 0, 0.66, 0.8824, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L35_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0238, 0, 0.66, 1.0, 979, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = sqlite3.OptimizedUnicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L36_C0", "label": "execute()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 0.8571, 0.0238, 0, 0.66, 1.0588, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L37_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.881, 0.0238, 0, 0.66, 1.1176, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Expr_L40_C0", "label": "execute()", "type": "expression", "loc": [40, 40], "level": 0, "parent": null, "vector": [8, 0, 0.9524, 0.0238, 0, 0.66, 1.2353, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (\"Germany\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_95:Assign_L41_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.9762, 0.0238, 0, 0.66, 1.2941, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}]
[]
from pysqlite2 import dbapi2 as sqlite3 class CountCursorsConnection(sqlite3.Connection): def __init__(self, *args, **kwargs): sqlite3.Connection.__init__(self, *args, **kwargs) self.numcursors = 0 def cursor(self, *args, **kwargs): self.numcursors += 1 return sqlite3.Connection.cursor(self, *args, **kwargs) con = sqlite3.connect(":memory:", factory=CountCursorsConnection) cur1 = con.cursor() cur2 = con.cursor() print con.numcursors
ajibawa-2023/Python-Code-Large/train/row_96
11
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_96:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:ClassDef_L3_C0", "label": "CountCursorsConnection", "type": "class", "loc": [3, 10], "level": 0, "parent": null, "vector": [3, 0, 0.4333, 0.5333, 0, 0.66, 0.2, 293, 0, 2, 0, 0, 809, 0, 2], "semantic": {"name": "CountCursorsConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CountCursorsConnection(sqlite3.Connection):\n def __init__(self, *args, **kwargs):\n sqlite3.Connection.__init__(self, *args, **kwargs)\n self.numcursors = 0\n\n def cursor(self, *args, **kwargs):\n self.numcursors += 1\n return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_96:ClassDef_L3_C0", "vector": [2, 1, 0.3333, 0.2, 1, 0.79, 0.0, 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 sqlite3.Connection.__init__(self, *args, **kwargs)\n self.numcursors = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Expr_L5_C8", "label": "__init__()", "type": "expression", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4", "vector": [8, 2, 0.3333, 0.0667, 2, 0.25, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite3.Connection.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Assign_L6_C8", "label": "self.numcursors =", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4", "vector": [14, 2, 0.4, 0.0667, 2, 0.25, 1.0, 848, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.numcursors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.numcursors = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L8_C4", "label": "cursor", "type": "function", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_96:ClassDef_L3_C0", "vector": [2, 1, 0.6, 0.2, 1, 0.79, 1.0, 231, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "cursor", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cursor(self, *args, **kwargs):\n self.numcursors += 1\n return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Return_L10_C8", "label": "return", "type": "return", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L8_C4", "vector": [13, 2, 0.6667, 0.0667, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.8, 0.0667, 0, 0.66, 0.4, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", factory=CountCursorsConnection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Assign_L13_C0", "label": "cur1 = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.8667, 0.0667, 0, 0.66, 0.6, 937, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur1", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur1 = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Assign_L14_C0", "label": "cur2 = cursor()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.9333, 0.0667, 0, 0.66, 0.8, 610, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur2", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur2 = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_96:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 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(con.numcursors)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_96:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_96:Expr_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_96:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_96:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_96:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_96:Return_L10_C8"}]
from pysqlite2 import dbapi2 as sqlite3 def collate_reverse(string1, string2): return -cmp(string1, string2) con = sqlite3.connect(":memory:") con.create_collation("reverse", collate_reverse) cur = con.cursor() cur.execute("create table test(x)") cur.executemany("insert into test(x) values (?)", [("a",), ("b",)]) cur.execute("select x from test order by x collate reverse") for row in cur: print row con.close()
ajibawa-2023/Python-Code-Large/train/row_97
12
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_97:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:FunctionDef_L3_C0", "label": "collate_reverse", "type": "function", "loc": [3, 4], "level": 0, "parent": null, "vector": [2, 0, 0.2333, 0.1333, 0, 0.66, 0.1111, 722, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "collate_reverse", "arg_names": ["string1", "string2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def collate_reverse(string1, string2):\n return -cmp(string1, string2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Return_L4_C4", "label": "return", "type": "return", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_97:FunctionDef_L3_C0", "vector": [13, 1, 0.2667, 0.0667, 1, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -cmp(string1, string2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Assign_L6_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.4, 0.0667, 0, 0.66, 0.2222, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L7_C0", "label": "create_collation()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.4667, 0.0667, 0, 0.66, 0.3333, 644, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_collation", "arg_names": [], "import_names": [], "rhs_call_name": "create_collation", "annotation": ""}, "snippet": "con.create_collation(\"reverse\", collate_reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0667, 0, 0.66, 0.4444, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0667, 0, 0.66, 0.5556, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(x)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L11_C0", "label": "executemany()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.7333, 0.0667, 0, 0.66, 0.6667, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into test(x) values (?)\", [(\"a\",), (\"b\",)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0667, 0, 0.66, 0.7778, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select x from test order by x collate reverse\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:For_L13_C0", "label": "for row", "type": "for", "loc": [13, 14], "level": 0, "parent": null, "vector": [6, 0, 0.9, 0.1333, 0, 0.66, 0.8889, 767, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L14_C4", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_97:For_L13_C0", "vector": [8, 1, 0.9333, 0.0667, 1, 0.24, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L15_C0", "label": "close()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_97:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_97:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_97:Expr_L14_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") cur = con.cursor() cur.executescript(""" create table person( firstname, lastname, age ); create table book( title, author, published ); insert into book(title, author, published) values ( 'Dirk Gently''s Holistic Detective Agency', 'Douglas Adams', 1987 ); """)
ajibawa-2023/Python-Code-Large/train/row_98
4
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_98:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0417, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98:Assign_L4_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.1667, 0.0417, 0, 0.66, 0.6667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_98:Expr_L5_C0", "label": "executescript()", "type": "expression", "loc": [5, 24], "level": 0, "parent": null, "vector": [8, 0, 0.6042, 0.8333, 0, 0.66, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": "cur.executescript(\"\"\"\n create table person(\n firstname,\n lastname,\n age\n );\n\n create table book("}]
[]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect(":memory:") # enable extension loading con.enable_load_extension(True) # Load the fulltext search extension con.execute("select load_extension('./fts3.so')") # alternatively you can load the extension using an API call: # con.load_extension("./fts3.so") # disable extension laoding again con.enable_load_extension(False) # example from SQLite wiki con.execute("create virtual table recipe using fts3(name, ingredients)") con.executescript(""" insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes'); insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery'); insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour'); insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter'); """) for row in con.execute("select rowid, name, ingredients from recipe where name match 'pie'"): print row
ajibawa-2023/Python-Code-Large/train/row_99
9
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_99:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1071, 0.0357, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L6_C0", "label": "enable_load_extension()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2143, 0.0357, 0, 0.66, 0.2857, 925, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_load_extension", "arg_names": [], "import_names": [], "rhs_call_name": "enable_load_extension", "annotation": ""}, "snippet": "con.enable_load_extension(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L9_C0", "label": "execute()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.3214, 0.0357, 0, 0.66, 0.4286, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"select load_extension('./fts3.so')\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L15_C0", "label": "enable_load_extension()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.5357, 0.0357, 0, 0.66, 0.5714, 925, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_load_extension", "arg_names": [], "import_names": [], "rhs_call_name": "enable_load_extension", "annotation": ""}, "snippet": "con.enable_load_extension(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.6429, 0.0357, 0, 0.66, 0.7143, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create virtual table recipe using fts3(name, ingredients)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L19_C0", "label": "executescript()", "type": "expression", "loc": [19, 24], "level": 0, "parent": null, "vector": [8, 0, 0.7679, 0.2143, 0, 0.66, 0.8571, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": "con.executescript(\"\"\"\n insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');\n insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');\n insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');\n insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:For_L25_C0", "label": "for row", "type": "for", "loc": [25, 26], "level": 0, "parent": null, "vector": [6, 0, 0.9107, 0.0714, 0, 0.66, 1.0, 767, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in con.execute(\"select rowid, name, ingredients from recipe where name match 'pie'\"):\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L26_C4", "label": "print()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_99:For_L25_C0", "vector": [8, 1, 0.9286, 0.0357, 1, 0.23, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_99:For_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_99:Expr_L26_C4"}]
from pysqlite2 import dbapi2 as sqlite3 persons = [ ("Hugo", "Boss"), ("Calvin", "Klein") ] con = sqlite3.connect(":memory:") # Create the table con.execute("create table person(firstname, lastname)") # Fill the table con.executemany("insert into person(firstname, lastname) values (?, ?)", persons) # Print the table contents for row in con.execute("select firstname, lastname from person"): print row # Using a dummy WHERE clause to not let SQLite take the shortcut table deletes. print "I just deleted", con.execute("delete from person where 1=1").rowcount, "rows"
ajibawa-2023/Python-Code-Large/train/row_100
8
21
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_100:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Assign_L3_C0", "label": "persons =", "type": "assigned_variable", "loc": [3, 6], "level": 0, "parent": null, "vector": [14, 0, 0.2143, 0.1905, 0, 0.66, 0.1667, 70, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "persons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "persons = [\n (\"Hugo\", \"Boss\"),\n (\"Calvin\", \"Klein\")\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.381, 0.0476, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Expr_L11_C0", "label": "execute()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.5238, 0.0476, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person(firstname, lastname)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Expr_L14_C0", "label": "executemany()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0476, 0, 0.66, 0.6667, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "con.executemany(\"insert into person(firstname, lastname) values (?, ?)\", persons)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:For_L17_C0", "label": "for row", "type": "for", "loc": [17, 18], "level": 0, "parent": null, "vector": [6, 0, 0.8333, 0.0952, 0, 0.66, 0.8333, 767, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in con.execute(\"select firstname, lastname from person\"):\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Expr_L18_C4", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_100:For_L17_C0", "vector": [8, 1, 0.8571, 0.0476, 1, 0.22, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_100:Expr_L21_C0", "label": "print()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0476, 0, 0.66, 1.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"I just deleted\", con.execute(\"delete from person where 1=1\").rowcount, \"rows\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_100:For_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_100:Expr_L18_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=:who and age=:age", locals()) print cur.fetchone()
ajibawa-2023/Python-Code-Large/train/row_101
7
12
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_101:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0833, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 11], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.1667, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_101:Expr_L12_C0", "label": "print()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0833, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}]
[]
# Not referenced from the documentation, but builds the database file the other # code snippets expect. from pysqlite2 import dbapi2 as sqlite3 import os DB_FILE = "mydb" if os.path.exists(DB_FILE): os.remove(DB_FILE) con = sqlite3.connect(DB_FILE) cur = con.cursor() cur.execute(""" create table people ( name_last varchar(20), age integer ) """) cur.execute("insert into people (name_last, age) values ('Yeltsin', 72)") cur.execute("insert into people (name_last, age) values ('Putin', 51)") con.commit() cur.close() con.close()
ajibawa-2023/Python-Code-Large/train/row_102
13
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_102:ImportFrom_L4_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1786, 0.0357, 0, 0.66, 0.0909, 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_102:Assign_L7_C0", "label": "DB_FILE =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0357, 0, 0.66, 0.1818, 437, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DB_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DB_FILE = \"mydb\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:If_L9_C0", "label": "if", "type": "if", "loc": [9, 10], "level": 0, "parent": null, "vector": [4, 0, 0.3393, 0.0714, 0, 0.66, 0.2727, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os.path.exists(DB_FILE):\n os.remove(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L10_C4", "label": "remove()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_102:If_L9_C0", "vector": [8, 1, 0.3571, 0.0357, 1, 0.92, 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(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0357, 0, 0.66, 0.3636, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Assign_L13_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.4643, 0.0357, 0, 0.66, 0.4545, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L14_C0", "label": "execute()", "type": "expression", "loc": [14, 20], "level": 0, "parent": null, "vector": [8, 0, 0.6071, 0.25, 0, 0.66, 0.5455, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"\"\"\n create table people\n (\n name_last varchar(20),\n age integer\n )\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L22_C0", "label": "execute()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.7857, 0.0357, 0, 0.66, 0.6364, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into people (name_last, age) values ('Yeltsin', 72)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L23_C0", "label": "execute()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.8214, 0.0357, 0, 0.66, 0.7273, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into people (name_last, age) values ('Putin', 51)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L25_C0", "label": "commit()", "type": "expression", "loc": [25, 25], "level": 0, "parent": null, "vector": [8, 0, 0.8929, 0.0357, 0, 0.66, 0.8182, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L27_C0", "label": "close()", "type": "expression", "loc": [27, 27], "level": 0, "parent": null, "vector": [8, 0, 0.9643, 0.0357, 0, 0.66, 0.9091, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L28_C0", "label": "close()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0357, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_102:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_102:Expr_L10_C4"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() who = "Yeltsin" age = 72 cur.execute("select name_last, age from people where name_last=:who and age=:age", {"who": who, "age": age}) print cur.fetchone()
ajibawa-2023/Python-Code-Large/train/row_103
7
12
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_103:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0833, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 11], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.1667, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n {\"who\": who, \"age\": age})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_103:Expr_L12_C0", "label": "print()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0833, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}]
[]
from pysqlite2 import dbapi2 as sqlite3 import datetime con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES) cur = con.cursor() cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),)) dt = cur.fetchone()[0] print dt, type(dt)
ajibawa-2023/Python-Code-Large/train/row_104
7
8
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_104:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_104:Import_L2_C0", "label": "datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.125, 0, 0.66, 0.1667, 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_104:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.125, 0, 0.66, 0.3333, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_104:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.625, 0.125, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_104:Expr_L6_C0", "label": "execute()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.125, 0, 0.66, 0.6667, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select ? as \"x [timestamp]\"', (datetime.datetime.now(),))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_104:Assign_L7_C0", "label": "dt =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.125, 0, 0.66, 0.8333, 455, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dt = cur.fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_104:Expr_L8_C0", "label": "print()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.125, 0, 0.66, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(dt, type(dt))"}]
[]
from pysqlite2 import dbapi2 as sqlite3 def char_generator(): import string for c in string.letters[:26]: yield (c,) con = sqlite3.connect(":memory:") cur = con.cursor() cur.execute("create table characters(c)") cur.executemany("insert into characters(c) values (?)", char_generator()) cur.execute("select c from characters") print cur.fetchall()
ajibawa-2023/Python-Code-Large/train/row_105
11
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_105:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:FunctionDef_L3_C0", "label": "char_generator", "type": "function", "loc": [3, 6], "level": 0, "parent": null, "vector": [2, 0, 0.3, 0.2667, 0, 0.66, 0.1429, 806, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "char_generator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def char_generator():\n import string\n for c in string.letters[:26]:\n yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Import_L4_C4", "label": "string import string", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_105:FunctionDef_L3_C0", "vector": [1, 1, 0.2667, 0.0667, 1, 0.41, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": " import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:For_L5_C4", "label": "for c", "type": "for", "loc": [5, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_105:FunctionDef_L3_C0", "vector": [6, 1, 0.3667, 0.1333, 1, 0.41, 1.0, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in string.letters[:26]:\n yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L6_C8", "label": "expression", "type": "expression", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_105:For_L5_C4", "vector": [8, 2, 0.4, 0.0667, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.5333, 0.0667, 0, 0.66, 0.2857, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0667, 0, 0.66, 0.4286, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0667, 0, 0.66, 0.5714, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table characters(c)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L12_C0", "label": "executemany()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0667, 0, 0.66, 0.7143, 175, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into characters(c) values (?)\", char_generator())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L14_C0", "label": "execute()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.9333, 0.0667, 0, 0.66, 0.8571, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select c from characters\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_105:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_105:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_105:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_105:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_105:For_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_105:Expr_L6_C8"}]
from pysqlite2 import dbapi2 as sqlite3 con = sqlite3.connect("mydb") cur = con.cursor() newPeople = ( ('Lebed' , 53), ('Zhirinovsky' , 57), ) for person in newPeople: cur.execute("insert into people (name_last, age) values (?, ?)", person) # The changes will not be saved unless the transaction is committed explicitly: con.commit()
ajibawa-2023/Python-Code-Large/train/row_106
7
16
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_106:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1875, 0.0625, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.3125, 0.0625, 0, 0.66, 0.4, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:Assign_L7_C0", "label": "newPeople =", "type": "assigned_variable", "loc": [7, 10], "level": 0, "parent": null, "vector": [14, 0, 0.5312, 0.25, 0, 0.66, 0.6, 423, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "newPeople", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "newPeople = (\n ('Lebed' , 53),\n ('Zhirinovsky' , 57),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:For_L12_C0", "label": "for person", "type": "for", "loc": [12, 13], "level": 0, "parent": null, "vector": [6, 0, 0.7812, 0.125, 0, 0.66, 0.8, 583, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "person", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for person in newPeople:\n cur.execute(\"insert into people (name_last, age) values (?, ?)\", person)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:Expr_L13_C4", "label": "execute()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_106:For_L12_C0", "vector": [8, 1, 0.8125, 0.0625, 1, 0.26, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into people (name_last, age) values (?, ?)\", person)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_106:Expr_L16_C0", "label": "commit()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0625, 0, 0.66, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "con.commit()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_106:For_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_106:Expr_L13_C4"}]
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def __conform__(self, protocol): if protocol is sqlite3.PrepareProtocol: return "%f;%f" % (self.x, self.y) con = sqlite3.connect(":memory:") cur = con.cursor() p = Point(4.0, -3.2) cur.execute("select ?", (p,)) print cur.fetchone()[0]
ajibawa-2023/Python-Code-Large/train/row_107
12
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_107:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 9], "level": 0, "parent": null, "vector": [3, 0, 0.375, 0.4375, 0, 0.66, 0.1667, 652, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __conform__(self, protocol):\n if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_107:ClassDef_L3_C0", "vector": [2, 1, 0.2812, 0.125, 1, 0.71, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L4_C4", "vector": [14, 2, 0.3125, 0.0625, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L7_C4", "label": "__conform__", "type": "function", "loc": [7, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_107:ClassDef_L3_C0", "vector": [2, 1, 0.5, 0.1875, 1, 0.71, 1.0, 753, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__conform__", "arg_names": ["self", "protocol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __conform__(self, protocol):\n if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:If_L8_C8", "label": "if", "type": "if", "loc": [8, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L7_C4", "vector": [4, 2, 0.5312, 0.125, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Return_L9_C12", "label": "return", "type": "return", "loc": [9, 9], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_107:If_L8_C8", "vector": [13, 3, 0.5625, 0.0625, 3, 0.21, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Assign_L11_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.6875, 0.0625, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Assign_L12_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0625, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Assign_L14_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.0625, 0, 0.66, 0.6667, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Expr_L15_C0", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.9375, 0.0625, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_107:Expr_L16_C0", "label": "print()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0625, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_107:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_107:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_107:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_107:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_107:If_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_107:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_107:Return_L9_C12"}]
from pysqlite2 import dbapi2 as sqlite3 class Point(object): def __init__(self, x, y): self.x, self.y = x, y def __repr__(self): return "(%f;%f)" % (self.x, self.y) def adapt_point(point): return "%f;%f" % (point.x, point.y) def convert_point(s): x, y = map(float, s.split(";")) return Point(x, y) # Register the adapter sqlite3.register_adapter(Point, adapt_point) # Register the converter sqlite3.register_converter("point", convert_point) p = Point(4.0, -3.2) ######################### # 1) Using declared types con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES) cur = con.cursor() cur.execute("create table test(p point)") cur.execute("insert into test(p) values (?)", (p,)) cur.execute("select p from test") print "with declared types:", cur.fetchone()[0] cur.close() con.close() ####################### # 1) Using column names con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES) cur = con.cursor() cur.execute("create table test(p)") cur.execute("insert into test(p) values (?)", (p,)) cur.execute('select p as "p [point]" from test') print "with column names:", cur.fetchone()[0] cur.close() con.close()
ajibawa-2023/Python-Code-Large/train/row_108
30
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_108:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 8], "level": 0, "parent": null, "vector": [3, 0, 0.117, 0.1277, 0, 0.66, 0.0455, 652, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __repr__(self):\n return \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:ClassDef_L3_C0", "vector": [2, 1, 0.0957, 0.0426, 1, 0.49, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L4_C4", "vector": [14, 2, 0.1064, 0.0213, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L7_C4", "label": "__repr__", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:ClassDef_L3_C0", "vector": [2, 1, 0.1596, 0.0426, 1, 0.49, 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 \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L7_C4", "vector": [13, 2, 0.1702, 0.0213, 2, 0.85, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L10_C0", "label": "adapt_point", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.2234, 0.0426, 0, 0.66, 0.0909, 704, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "adapt_point", "arg_names": ["point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_point(point):\n return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L10_C0", "vector": [13, 1, 0.234, 0.0213, 1, 0.8, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L13_C0", "label": "convert_point", "type": "function", "loc": [13, 15], "level": 0, "parent": null, "vector": [2, 0, 0.2979, 0.0638, 0, 0.66, 0.1364, 480, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "convert_point", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convert_point(s):\n x, y = map(float, s.split(\";\"))\n return Point(x, y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L14_C4", "label": "x, y = map()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L13_C0", "vector": [14, 1, 0.2979, 0.0213, 1, 0.31, 0.0, 855, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "x, y", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " x, y = map(float, s.split(\";\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L15_C4", "label": "return", "type": "return", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L13_C0", "vector": [13, 1, 0.3191, 0.0213, 1, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Point(x, y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L18_C0", "label": "register_adapter()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.383, 0.0213, 0, 0.66, 0.1818, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(Point, adapt_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L21_C0", "label": "register_converter()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.4468, 0.0213, 0, 0.66, 0.2273, 121, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_converter", "arg_names": [], "import_names": [], "rhs_call_name": "register_converter", "annotation": ""}, "snippet": "sqlite3.register_converter(\"point\", convert_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L23_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.4894, 0.0213, 0, 0.66, 0.2727, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L27_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.5745, 0.0213, 0, 0.66, 0.3182, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L28_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.5957, 0.0213, 0, 0.66, 0.3636, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L29_C0", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.617, 0.0213, 0, 0.66, 0.4091, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(p point)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L31_C0", "label": "execute()", "type": "expression", "loc": [31, 31], "level": 0, "parent": null, "vector": [8, 0, 0.6596, 0.0213, 0, 0.66, 0.4545, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(p) values (?)\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L32_C0", "label": "execute()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 0.6809, 0.0213, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select p from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L33_C0", "label": "print()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.7021, 0.0213, 0, 0.66, 0.5455, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"with declared types:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L34_C0", "label": "close()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.7234, 0.0213, 0, 0.66, 0.5909, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L35_C0", "label": "close()", "type": "expression", "loc": [35, 35], "level": 0, "parent": null, "vector": [8, 0, 0.7447, 0.0213, 0, 0.66, 0.6364, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L39_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.8298, 0.0213, 0, 0.66, 0.6818, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L40_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.8511, 0.0213, 0, 0.66, 0.7273, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L41_C0", "label": "execute()", "type": "expression", "loc": [41, 41], "level": 0, "parent": null, "vector": [8, 0, 0.8723, 0.0213, 0, 0.66, 0.7727, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(p)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L43_C0", "label": "execute()", "type": "expression", "loc": [43, 43], "level": 0, "parent": null, "vector": [8, 0, 0.9149, 0.0213, 0, 0.66, 0.8182, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(p) values (?)\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L44_C0", "label": "execute()", "type": "expression", "loc": [44, 44], "level": 0, "parent": null, "vector": [8, 0, 0.9362, 0.0213, 0, 0.66, 0.8636, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select p as \"p [point]\" from test')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L45_C0", "label": "print()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.9574, 0.0213, 0, 0.66, 0.9091, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"with column names:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L46_C0", "label": "close()", "type": "expression", "loc": [46, 46], "level": 0, "parent": null, "vector": [8, 0, 0.9787, 0.0213, 0, 0.66, 0.9545, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_108:Expr_L47_C0", "label": "close()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0213, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_108:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_108:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_108:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_108:Return_L15_C4"}]
from pysqlite2 import dbapi2 as sqlite3 class IterChars: def __init__(self): self.count = ord('a') def __iter__(self): return self def next(self): if self.count > ord('z'): raise StopIteration self.count += 1 return (chr(self.count - 1),) # this is a 1-tuple con = sqlite3.connect(":memory:") cur = con.cursor() cur.execute("create table characters(c)") theIter = IterChars() cur.executemany("insert into characters(c) values (?)", theIter) cur.execute("select c from characters") print cur.fetchall()
ajibawa-2023/Python-Code-Large/train/row_109
16
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_109:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "label": "IterChars", "type": "class", "loc": [3, 14], "level": 0, "parent": null, "vector": [3, 0, 0.3542, 0.5, 0, 0.66, 0.125, 192, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "IterChars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IterChars:\n def __init__(self):\n self.count = ord('a')\n\n def __iter__(self):\n return self\n\n def next(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "vector": [2, 1, 0.1875, 0.0833, 1, 0.87, 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.count = ord('a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Assign_L5_C8", "label": "self.count = ord()", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L4_C4", "vector": [14, 2, 0.2083, 0.0417, 2, 0.38, 0.0, 340, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "self.count", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " self.count = ord('a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L7_C4", "label": "__iter__", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "vector": [2, 1, 0.3125, 0.0833, 1, 0.87, 0.5, 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_109:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L7_C4", "vector": [13, 2, 0.3333, 0.0417, 2, 0.2, 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_109:FunctionDef_L10_C4", "label": "next", "type": "function", "loc": [10, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "vector": [2, 1, 0.5, 0.2083, 1, 0.87, 1.0, 11, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def next(self):\n if self.count > ord('z'):\n raise StopIteration\n self.count += 1\n return (chr(self.count - 1),) # this is a 1-tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:If_L11_C8", "label": "if", "type": "if", "loc": [11, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L10_C4", "vector": [4, 2, 0.4792, 0.0833, 2, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.count > ord('z'):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L10_C4", "vector": [13, 2, 0.5833, 0.0417, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (chr(self.count - 1),) # this is a 1-tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Assign_L16_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0417, 0, 0.66, 0.25, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Assign_L17_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.7083, 0.0417, 0, 0.66, 0.375, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.0417, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table characters(c)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Assign_L20_C0", "label": "theIter = IterChars()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0417, 0, 0.66, 0.625, 800, 3, 0, 0, 0, 192, 10, 1], "semantic": {"name": "theIter", "arg_names": [], "import_names": [], "rhs_call_name": "IterChars", "annotation": ""}, "snippet": "theIter = IterChars()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Expr_L21_C0", "label": "executemany()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.0417, 0, 0.66, 0.75, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into characters(c) values (?)\", theIter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Expr_L23_C0", "label": "execute()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.9583, 0.0417, 0, 0.66, 0.875, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select c from characters\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_109:Expr_L24_C0", "label": "print()", "type": "expression", "loc": [24, 24], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0417, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_109:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_109:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_109:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_109:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_109:Return_L14_C8"}]
from pysqlite2 import dbapi2 as sqlite3 import apsw apsw_con = apsw.Connection(":memory:") apsw_con.createscalarfunction("times_two", lambda x: 2*x, 1) # Create pysqlite connection from APSW connection con = sqlite3.connect(apsw_con) result = con.execute("select times_two(15)").fetchone()[0] assert result == 30 con.close()
ajibawa-2023/Python-Code-Large/train/row_110
7
12
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_110:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Import_L2_C0", "label": "apsw import apsw", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.1667, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "apsw", "arg_names": [], "import_names": ["apsw"], "rhs_call_name": "", "annotation": ""}, "snippet": "import apsw"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Assign_L4_C0", "label": "apsw_con = Connection()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.3333, 112, 3, 1, 0, 0, 823, 10, 1], "semantic": {"name": "apsw_con", "arg_names": [], "import_names": [], "rhs_call_name": "Connection", "annotation": ""}, "snippet": "apsw_con = apsw.Connection(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Expr_L5_C0", "label": "createscalarfunction()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.4167, 0.0833, 0, 0.66, 0.5, 36, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "createscalarfunction", "arg_names": [], "import_names": [], "rhs_call_name": "createscalarfunction", "annotation": ""}, "snippet": "apsw_con.createscalarfunction(\"times_two\", lambda x: 2*x, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(apsw_con)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Assign_L9_C0", "label": "result =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0833, 0, 0.66, 0.8333, 51, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "result = con.execute(\"select times_two(15)\").fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_110:Expr_L11_C0", "label": "close()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.9167, 0.0833, 0, 0.66, 1.1667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}]
[]
from pysqlite2 import dbapi2 as sqlite3 import datetime, time def adapt_datetime(ts): return time.mktime(ts.timetuple()) sqlite3.register_adapter(datetime.datetime, adapt_datetime) con = sqlite3.connect(":memory:") cur = con.cursor() now = datetime.datetime.now() cur.execute("select ?", (now,)) print cur.fetchone()[0]
ajibawa-2023/Python-Code-Large/train/row_111
10
14
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_111:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Import_L2_C0", "label": "datetime import datetime, time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.125, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime, time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:FunctionDef_L4_C0", "label": "adapt_datetime", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.3214, 0.1429, 0, 0.66, 0.25, 242, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "adapt_datetime", "arg_names": ["ts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_datetime(ts):\n return time.mktime(ts.timetuple())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_111:FunctionDef_L4_C0", "vector": [13, 1, 0.3571, 0.0714, 1, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return time.mktime(ts.timetuple())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Expr_L7_C0", "label": "register_adapter()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0714, 0, 0.66, 0.375, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(datetime.datetime, adapt_datetime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Assign_L9_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6429, 0.0714, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Assign_L10_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.0714, 0, 0.66, 0.625, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Assign_L12_C0", "label": "now = now()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.0714, 0, 0.66, 0.75, 894, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": "now = datetime.datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Expr_L13_C0", "label": "execute()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.0714, 0, 0.66, 0.875, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (now,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_111:Expr_L14_C0", "label": "print()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0714, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_111:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_111:Return_L5_C4"}]
# Author: Paul Kippes <kippesp@gmail.com> import unittest from pysqlite2 import dbapi2 as sqlite class DumpTests(unittest.TestCase): def setUp(self): self.cx = sqlite.connect(":memory:") self.cu = self.cx.cursor() def tearDown(self): self.cx.close() def CheckTableDump(self): expected_sqls = [ "CREATE TABLE t1(id integer primary key, s1 text, " \ "t1_i1 integer not null, i2 integer, unique (s1), " \ "constraint t1_idx1 unique (i2));" , "INSERT INTO \"t1\" VALUES(1,'foo',10,20);" , "INSERT INTO \"t1\" VALUES(2,'foo2',30,30);" , "CREATE TABLE t2(id integer, t2_i1 integer, " \ "t2_i2 integer, primary key (id)," \ "foreign key(t2_i1) references t1(t1_i1));" , "CREATE TRIGGER trigger_1 update of t1_i1 on t1 " \ "begin " \ "update t2 set t2_i1 = new.t1_i1 where t2_i1 = old.t1_i1; " \ "end;" , "CREATE VIEW v1 as select * from t1 left join t2 " \ "using (id);" ] [self.cu.execute(s) for s in expected_sqls] i = self.cx.iterdump() actual_sqls = [s for s in i] expected_sqls = ['BEGIN TRANSACTION;'] + expected_sqls + \ ['COMMIT;'] [self.assertEqual(expected_sqls[i], actual_sqls[i]) for i in xrange(len(expected_sqls))] def suite(): return unittest.TestSuite(unittest.makeSuite(DumpTests, "Check")) def test(): runner = unittest.TextTestRunner() runner.run(suite()) if __name__ == "__main__": test()
ajibawa-2023/Python-Code-Large/train/row_112
22
52
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_112:Import_L3_C0", "label": "unittest import unittest", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:ImportFrom_L4_C0", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0192, 0, 0.66, 0.2, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "label": "DumpTests", "type": "class", "loc": [6, 42], "level": 0, "parent": null, "vector": [3, 0, 0.4615, 0.7115, 0, 0.66, 0.4, 461, 0, 3, 0, 0, 878, 0, 8], "semantic": {"name": "DumpTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DumpTests(unittest.TestCase):\n def setUp(self):\n self.cx = sqlite.connect(\":memory:\")\n self.cu = self.cx.cursor()\n\n def tearDown(self):\n self.cx.close()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4", "label": "setUp", "type": "function", "loc": [7, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "vector": [2, 1, 0.1538, 0.0577, 1, 0.58, 0.0, 952, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.cx = sqlite.connect(\":memory:\")\n self.cu = self.cx.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L8_C8", "label": "self.cx = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4", "vector": [14, 2, 0.1538, 0.0192, 2, 0.45, 0.0, 349, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "self.cx", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.cx = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L9_C8", "label": "self.cu = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4", "vector": [14, 2, 0.1731, 0.0192, 2, 0.45, 1.0, 914, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "self.cu", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " self.cu = self.cx.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L11_C4", "label": "tearDown", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "vector": [2, 1, 0.2212, 0.0385, 1, 0.58, 0.5, 530, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "tearDown", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tearDown(self):\n self.cx.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L12_C8", "label": "close()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L11_C4", "vector": [8, 2, 0.2308, 0.0192, 2, 0.21, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.cx.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "label": "CheckTableDump", "type": "function", "loc": [14, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "vector": [2, 1, 0.5385, 0.5577, 1, 0.58, 1.0, 300, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "CheckTableDump", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def CheckTableDump(self):\n expected_sqls = [\n \"CREATE TABLE t1(id integer primary key, s1 text, \" \\\n \"t1_i1 integer not null, i2 integer, unique (s1), \" \\\n \"constraint t1_idx1 unique (i2));\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(1,'foo',10,20);\"\n ,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L15_C8", "label": "expected_sqls =", "type": "assigned_variable", "loc": [15, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [14, 2, 0.4808, 0.4038, 2, 0.1, 0.0, 56, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "expected_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected_sqls = [\n \"CREATE TABLE t1(id integer primary key, s1 text, \" \\\n \"t1_i1 integer not null, i2 integer, unique (s1), \" \\\n \"constraint t1_idx1 unique (i2));\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(1,'foo',10,20);\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(2,'foo2',30,30);\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L36_C8", "label": "expression", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [8, 2, 0.6923, 0.0192, 2, 0.1, 0.2, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [self.cu.execute(s) for s in expected_sqls]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L37_C8", "label": "i = iterdump()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [14, 2, 0.7115, 0.0192, 2, 0.1, 0.4, 826, 3, 0, 0, 0, 277, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "iterdump", "annotation": ""}, "snippet": " i = self.cx.iterdump()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L38_C8", "label": "actual_sqls =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [14, 2, 0.7308, 0.0192, 2, 0.1, 0.6, 863, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "actual_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " actual_sqls = [s for s in i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L39_C8", "label": "expected_sqls =", "type": "assigned_variable", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [14, 2, 0.7596, 0.0385, 2, 0.1, 0.8, 56, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected_sqls = ['BEGIN TRANSACTION;'] + expected_sqls + \\\n ['COMMIT;']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "vector": [8, 2, 0.7981, 0.0385, 2, 0.1, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [self.assertEqual(expected_sqls[i], actual_sqls[i])\n for i in xrange(len(expected_sqls))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L44_C0", "label": "suite", "type": "function", "loc": [44, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8558, 0.0385, 0, 0.66, 0.6, 425, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n return unittest.TestSuite(unittest.makeSuite(DumpTests, \"Check\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Return_L45_C4", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L44_C0", "vector": [13, 1, 0.8654, 0.0192, 1, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unittest.TestSuite(unittest.makeSuite(DumpTests, \"Check\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L47_C0", "label": "test", "type": "function", "loc": [47, 49], "level": 0, "parent": null, "vector": [2, 0, 0.9231, 0.0577, 0, 0.66, 0.8, 224, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n runner = unittest.TextTestRunner()\n runner.run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L48_C4", "label": "runner = TextTestRunner()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L47_C0", "vector": [14, 1, 0.9231, 0.0192, 1, 0.49, 0.0, 180, 3, 0, 0, 0, 130, 10, 1], "semantic": {"name": "runner", "arg_names": [], "import_names": [], "rhs_call_name": "TextTestRunner", "annotation": ""}, "snippet": " runner = unittest.TextTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L49_C4", "label": "run()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L47_C0", "vector": [8, 1, 0.9423, 0.0192, 1, 0.49, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " runner.run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:If_L51_C0", "label": "if", "type": "if", "loc": [51, 52], "level": 0, "parent": null, "vector": [4, 0, 0.9904, 0.0385, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L52_C4", "label": "test()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_112:If_L51_C0", "vector": [8, 1, 1.0, 0.0192, 1, 0.43, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Return_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_112:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_112:Expr_L52_C4"}]
# Mimic the sqlite3 console shell's .dump command # Author: Paul Kippes <kippesp@gmail.com> def _iterdump(connection): """ Returns an iterator to the dump of the database in an SQL text format. Used to produce an SQL dump of the database. Useful to save an in-memory database for later restoration. This function should not be called directly but instead called from the Connection method, iterdump(). """ cu = connection.cursor() yield('BEGIN TRANSACTION;') # sqlite_master table contains the SQL CREATE statements for the database. q = """ SELECT name, type, sql FROM sqlite_master WHERE sql NOT NULL AND type == 'table' """ schema_res = cu.execute(q) for table_name, type, sql in schema_res.fetchall(): if table_name == 'sqlite_sequence': yield('DELETE FROM sqlite_sequence;') elif table_name == 'sqlite_stat1': yield('ANALYZE sqlite_master;') elif table_name.startswith('sqlite_'): continue # NOTE: Virtual table support not implemented #elif sql.startswith('CREATE VIRTUAL TABLE'): # qtable = table_name.replace("'", "''") # yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"\ # "VALUES('table','%s','%s',0,'%s');" % # qtable, # qtable, # sql.replace("''")) else: yield('%s;' % sql) # Build the insert statement for each row of the current table res = cu.execute("PRAGMA table_info('%s')" % table_name) column_names = [str(table_info[1]) for table_info in res.fetchall()] q = "SELECT 'INSERT INTO \"%(tbl_name)s\" VALUES(" q += ",".join(["'||quote(" + col + ")||'" for col in column_names]) q += ")' FROM '%(tbl_name)s'" query_res = cu.execute(q % {'tbl_name': table_name}) for row in query_res: yield("%s;" % row[0]) # Now when the type is 'index', 'trigger', or 'view' q = """ SELECT name, type, sql FROM sqlite_master WHERE sql NOT NULL AND type IN ('index', 'trigger', 'view') """ schema_res = cu.execute(q) for name, type, sql in schema_res.fetchall(): yield('%s;' % sql) yield('COMMIT;')
ajibawa-2023/Python-Code-Large/train/row_113
24
63
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "label": "_iterdump", "type": "function", "loc": [4, 63], "level": 0, "parent": null, "vector": [2, 0, 0.5317, 0.9524, 0, 0.66, 0.0, 339, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "_iterdump", "arg_names": ["connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _iterdump(connection):\n \"\"\"\n Returns an iterator to the dump of the database in an SQL text format.\n\n Used to produce an SQL dump of the database. Useful to save an in-memory\n database for later restoration. This function should not be called\n directly but instead called from the Connection method, iterdump().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [8, 1, 0.127, 0.1111, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns an iterator to the dump of the database in an SQL text format.\n\n Used to produce an SQL dump of the database. Useful to save an in-memory\n database for later restoration. This function should not be called\n directly but instead called from the Connection method, iterdump().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L13_C4", "label": "cu = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [14, 1, 0.2063, 0.0159, 1, 0.84, 0.1111, 145, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cu", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cu = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [8, 1, 0.2222, 0.0159, 1, 0.84, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('BEGIN TRANSACTION;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L17_C4", "label": "q =", "type": "assigned_variable", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [14, 1, 0.3095, 0.0952, 1, 0.84, 0.3333, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"\"\"\n SELECT name, type, sql\n FROM sqlite_master\n WHERE sql NOT NULL AND\n type == 'table'\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L23_C4", "label": "schema_res = execute()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [14, 1, 0.3651, 0.0159, 1, 0.84, 0.4444, 84, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "schema_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " schema_res = cu.execute(q)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "label": "for table_name, type, sql", "type": "for", "loc": [24, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [6, 1, 0.5873, 0.4286, 1, 0.84, 0.5556, 166, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "table_name, type, sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for table_name, type, sql in schema_res.fetchall():\n if table_name == 'sqlite_sequence':\n yield('DELETE FROM sqlite_sequence;')\n elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8", "label": "if", "type": "if", "loc": [25, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [4, 2, 0.5159, 0.254, 2, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_name == 'sqlite_sequence':\n yield('DELETE FROM sqlite_sequence;')\n elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L26_C12", "label": "expression", "type": "expression", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8", "vector": [8, 3, 0.4127, 0.0159, 3, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('DELETE FROM sqlite_sequence;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8", "label": "if", "type": "if", "loc": [27, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8", "vector": [4, 3, 0.5317, 0.2222, 3, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):\n # qtable = table_name.replace(\"'\", \"''\")\n # yield(\"INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)\"\\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L28_C12", "label": "expression", "type": "expression", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8", "vector": [8, 4, 0.4444, 0.0159, 4, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('ANALYZE sqlite_master;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:If_L29_C8", "label": "if", "type": "if", "loc": [29, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8", "vector": [4, 4, 0.5476, 0.1905, 4, 0.73, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):\n # qtable = table_name.replace(\"'\", \"''\")\n # yield(\"INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)\"\\\n # \"VALUES('table','%s','%s',0,'%s');\" %\n # qtable,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L40_C12", "label": "expression", "type": "expression", "loc": [40, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:If_L29_C8", "vector": [8, 5, 0.6349, 0.0159, 5, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L43_C8", "label": "res = execute()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [14, 2, 0.6825, 0.0159, 2, 0.51, 0.2, 413, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " res = cu.execute(\"PRAGMA table_info('%s')\" % table_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L44_C8", "label": "column_names =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [14, 2, 0.6984, 0.0159, 2, 0.51, 0.4, 598, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "column_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " column_names = [str(table_info[1]) for table_info in res.fetchall()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L45_C8", "label": "q =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [14, 2, 0.7143, 0.0159, 2, 0.51, 0.6, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"SELECT 'INSERT INTO \\\"%(tbl_name)s\\\" VALUES(\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L48_C8", "label": "query_res = execute()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [14, 2, 0.7619, 0.0159, 2, 0.51, 0.8, 20, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "query_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " query_res = cu.execute(q % {'tbl_name': table_name})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:For_L49_C8", "label": "for row", "type": "for", "loc": [49, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "vector": [6, 2, 0.7857, 0.0317, 2, 0.51, 1.0, 767, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in query_res:\n yield(\"%s;\" % row[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L50_C12", "label": "expression", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L49_C8", "vector": [8, 3, 0.7937, 0.0159, 3, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield(\"%s;\" % row[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L53_C4", "label": "q =", "type": "assigned_variable", "loc": [53, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [14, 1, 0.881, 0.0952, 1, 0.84, 0.6667, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"\"\"\n SELECT name, type, sql\n FROM sqlite_master\n WHERE sql NOT NULL AND\n type IN ('index', 'trigger', 'view')\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L59_C4", "label": "schema_res = execute()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [14, 1, 0.9365, 0.0159, 1, 0.84, 0.7778, 84, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "schema_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " schema_res = cu.execute(q)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:For_L60_C4", "label": "for name, type, sql", "type": "for", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [6, 1, 0.9603, 0.0317, 1, 0.84, 0.8889, 331, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name, type, sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, type, sql in schema_res.fetchall():\n yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L61_C8", "label": "expression", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:For_L60_C4", "vector": [8, 2, 0.9683, 0.0159, 2, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L63_C4", "label": "expression", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "vector": [8, 1, 1.0, 0.0159, 1, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('COMMIT;')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:For_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_113:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_113:Expr_L63_C4"}]
#coding:utf8 from bottle import route, run, debug, template, request, validate, error, response, redirect from y_common import * from weibopy.auth import WebOAuthHandler from weibopy import oauth @route('/login') def login(): redirect('/sina/login') @route('/sina/login') def sina_login(): auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret) auth_url = auth.get_authorization_url_with_callback(baseurl + "/sina/callback/") redirect(auth_url) @route('/sina/callback/:request_token') def sina_callback(request_token): oauth_verifier = request.GET.get('oauth_verifier', None) auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret, oauth.OAuthToken.from_string(request_token)) token = auth.get_access_token(oauth_verifier) response.set_cookie("ybole_auth", token, secret = gng_secret) redirect('/')
ajibawa-2023/Python-Code-Large/train/row_114
16
23
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_114:ImportFrom_L2_C0", "label": "from bottle import route, run, debug\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.0, 591, 0, 9, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["route", "run", "debug", "template", "request", "validate", "error", "response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import route, run, debug, template, request, validate, error, response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:ImportFrom_L3_C0", "label": "from y_common import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1304, 0.0435, 0, 0.66, 0.1667, 64, 0, 1, 0, 0, 64, 0, 0], "semantic": {"name": "y_common", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from y_common import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:ImportFrom_L4_C0", "label": "from weibopy.auth import WebOAuthHandler", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0435, 0, 0.66, 0.3333, 550, 0, 1, 0, 0, 550, 0, 0], "semantic": {"name": "weibopy.auth", "arg_names": [], "import_names": ["WebOAuthHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.auth import WebOAuthHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:ImportFrom_L5_C0", "label": "from weibopy import oauth", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2174, 0.0435, 0, 0.66, 0.5, 75, 0, 1, 0, 0, 75, 0, 0], "semantic": {"name": "weibopy", "arg_names": [], "import_names": ["oauth"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy import oauth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L8_C0", "label": "login", "type": "function", "loc": [8, 9], "level": 0, "parent": null, "vector": [2, 0, 0.3696, 0.087, 0, 0.66, 0.6667, 724, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "login", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def login():\n redirect('/sina/login')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L9_C4", "label": "redirect()", "type": "expression", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L8_C0", "vector": [8, 1, 0.3913, 0.0435, 1, 0.17, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect('/sina/login')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "label": "sina_login", "type": "function", "loc": [12, 15], "level": 0, "parent": null, "vector": [2, 0, 0.587, 0.1739, 0, 0.66, 0.8333, 171, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "sina_login", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sina_login():\n auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret)\n auth_url = auth.get_authorization_url_with_callback(baseurl + \"/sina/callback/\")\n redirect(auth_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L13_C4", "label": "auth = WebOAuthHandler()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "vector": [14, 1, 0.5652, 0.0435, 1, 0.35, 0.0, 280, 3, 2, 0, 0, 755, 10, 1], "semantic": {"name": "auth", "arg_names": [], "import_names": [], "rhs_call_name": "WebOAuthHandler", "annotation": ""}, "snippet": " auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L14_C4", "label": "auth_url = get_authorization_url_with_callback()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "vector": [14, 1, 0.6087, 0.0435, 1, 0.35, 0.5, 911, 3, 1, 0, 0, 910, 10, 1], "semantic": {"name": "auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "get_authorization_url_with_callback", "annotation": ""}, "snippet": " auth_url = auth.get_authorization_url_with_callback(baseurl + \"/sina/callback/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L15_C4", "label": "redirect()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "vector": [8, 1, 0.6522, 0.0435, 1, 0.35, 1.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(auth_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "label": "sina_callback", "type": "function", "loc": [18, 23], "level": 0, "parent": null, "vector": [2, 0, 0.8913, 0.2609, 0, 0.66, 1.0, 14, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "sina_callback", "arg_names": ["request_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sina_callback(request_token):\n oauth_verifier = request.GET.get('oauth_verifier', None)\n auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret, oauth.OAuthToken.from_string(request_token))\n token = auth.get_access_token(oauth_verifier)\n response.set_cookie(\"ybole_auth\", token, secret = gng_secret)\n redirect('/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L19_C4", "label": "oauth_verifier = get()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "vector": [14, 1, 0.8261, 0.0435, 1, 0.72, 0.0, 121, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "oauth_verifier", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " oauth_verifier = request.GET.get('oauth_verifier', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L20_C4", "label": "auth = WebOAuthHandler()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "vector": [14, 1, 0.8696, 0.0435, 1, 0.72, 0.25, 280, 3, 3, 0, 0, 755, 10, 2], "semantic": {"name": "auth", "arg_names": [], "import_names": [], "rhs_call_name": "WebOAuthHandler", "annotation": ""}, "snippet": " auth = WebOAuthHandler(sina_consumer_key, sina_consumer_secret, oauth.OAuthToken.from_string(request_token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L21_C4", "label": "token = get_access_token()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "vector": [14, 1, 0.913, 0.0435, 1, 0.72, 0.5, 129, 3, 1, 0, 0, 604, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "get_access_token", "annotation": ""}, "snippet": " token = auth.get_access_token(oauth_verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L22_C4", "label": "set_cookie()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "vector": [8, 1, 0.9565, 0.0435, 1, 0.72, 0.75, 146, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_cookie", "arg_names": [], "import_names": [], "rhs_call_name": "set_cookie", "annotation": ""}, "snippet": " response.set_cookie(\"ybole_auth\", token, secret = gng_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L23_C4", "label": "redirect()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "vector": [8, 1, 1.0, 0.0435, 1, 0.72, 1.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect('/')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_114:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_114:Expr_L23_C4"}]
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/apply/sent') @route('/apply/sent/show') def apply_sent_show(): return template('home') @route('/apply/sent/add/:tweet_id') def apply_sent_add(tweet_id): return template('home') @route('/apply/sent/exist/:tweet_id') def apply_sent_exist(tweet_id): return template('home') @route('/apply/sent/count') def apply_sent_count(): return template('home') @route('/apply/sent/delete/:tweet_id') def apply_sent_delete(tweet_id): return template('home')
ajibawa-2023/Python-Code-Large/train/row_115
11
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_115:ImportFrom_L1_C0", "label": "from bottle import route, run, debug\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 591, 0, 9, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["route", "run", "debug", "template", "request", "validate", "error", "response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import route, run, debug, template, request, validate, error, response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L5_C0", "label": "apply_sent_show", "type": "function", "loc": [5, 6], "level": 0, "parent": null, "vector": [2, 0, 0.25, 0.0909, 0, 0.66, 0.2, 409, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "apply_sent_show", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_sent_show():\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L6_C4", "label": "return", "type": "return", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L5_C0", "vector": [13, 1, 0.2727, 0.0455, 1, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L9_C0", "label": "apply_sent_add", "type": "function", "loc": [9, 10], "level": 0, "parent": null, "vector": [2, 0, 0.4318, 0.0909, 0, 0.66, 0.4, 690, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "apply_sent_add", "arg_names": ["tweet_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_sent_add(tweet_id):\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L10_C4", "label": "return", "type": "return", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L9_C0", "vector": [13, 1, 0.4545, 0.0455, 1, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L13_C0", "label": "apply_sent_exist", "type": "function", "loc": [13, 14], "level": 0, "parent": null, "vector": [2, 0, 0.6136, 0.0909, 0, 0.66, 0.6, 683, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "apply_sent_exist", "arg_names": ["tweet_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_sent_exist(tweet_id):\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L14_C4", "label": "return", "type": "return", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L13_C0", "vector": [13, 1, 0.6364, 0.0455, 1, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L17_C0", "label": "apply_sent_count", "type": "function", "loc": [17, 18], "level": 0, "parent": null, "vector": [2, 0, 0.7955, 0.0909, 0, 0.66, 0.8, 823, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "apply_sent_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_sent_count():\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L18_C4", "label": "return", "type": "return", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L17_C0", "vector": [13, 1, 0.8182, 0.0455, 1, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L21_C0", "label": "apply_sent_delete", "type": "function", "loc": [21, 22], "level": 0, "parent": null, "vector": [2, 0, 0.9773, 0.0909, 0, 0.66, 1.0, 672, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "apply_sent_delete", "arg_names": ["tweet_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def apply_sent_delete(tweet_id):\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L21_C0", "vector": [13, 1, 1.0, 0.0455, 1, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_115:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_115:Return_L22_C4"}]
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/') @route('/home') def home(): return template('home') #return 'Ybole - Python backend ... Coming soon!'
ajibawa-2023/Python-Code-Large/train/row_116
3
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_116:ImportFrom_L1_C0", "label": "from bottle import route, run, debug\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 591, 0, 9, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["route", "run", "debug", "template", "request", "validate", "error", "response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import route, run, debug, template, request, validate, error, response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_116:FunctionDef_L5_C0", "label": "home", "type": "function", "loc": [5, 6], "level": 0, "parent": null, "vector": [2, 0, 0.7857, 0.2857, 0, 0.66, 1.0, 475, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "home", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def home():\n return template('home')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_116:Return_L6_C4", "label": "return", "type": "return", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_116:FunctionDef_L5_C0", "vector": [13, 1, 0.8571, 0.1429, 1, 0.92, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template('home')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_116:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_116:Return_L6_C4"}]
from bottle import route, run, debug, template, request, validate, error, response, redirect @route('/admin/') def admin(): return template("home") @route('/admin/tag') def admin_tag(): return template("home") @route('/admin/tag/edit') def admin_tag(): return template("home")
ajibawa-2023/Python-Code-Large/train/row_117
7
13
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_117:ImportFrom_L1_C0", "label": "from bottle import route, run, debug\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 591, 0, 9, 0, 0, 591, 0, 0], "semantic": {"name": "bottle", "arg_names": [], "import_names": ["route", "run", "debug", "template", "request", "validate", "error", "response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from bottle import route, run, debug, template, request, validate, error, response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L4_C0", "label": "admin", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.3462, 0.1538, 0, 0.66, 0.3333, 426, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "admin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def admin():\n return template(\"home\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L4_C0", "vector": [13, 1, 0.3846, 0.0769, 1, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template(\"home\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L8_C0", "label": "admin_tag", "type": "function", "loc": [8, 9], "level": 0, "parent": null, "vector": [2, 0, 0.6538, 0.1538, 0, 0.66, 0.6667, 515, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "admin_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def admin_tag():\n return template(\"home\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L9_C4", "label": "return", "type": "return", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L8_C0", "vector": [13, 1, 0.6923, 0.0769, 1, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template(\"home\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L12_C0", "label": "admin_tag", "type": "function", "loc": [12, 13], "level": 0, "parent": null, "vector": [2, 0, 0.9615, 0.1538, 0, 0.66, 1.0, 515, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "admin_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def admin_tag():\n return template(\"home\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L12_C0", "vector": [13, 1, 1.0, 0.0769, 1, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return template(\"home\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_117:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_117:Return_L13_C4"}]
import re, base64, json baseurl = "http://www.ybole.com:81" gng_secret = "HUSTGNGisVeryGelivable" sina_consumer_key= "961495784" sina_consumer_secret ="47d9d806a1dc04cc758be6f7213465bc" def htmlEncode(str): """ Returns the HTML encoded version of the given string. This is useful to display a plain ASCII text string on a web page.""" htmlCodes = [ ['&', '&amp;'], ['<', '&lt;'], ['>', '&gt;'], ['"', '&quot;'], ] for orig, repl in htmlCodes: str = str.replace(orig, repl) return str def jsonencode(x): data = dict(x) return json.dumps(data)
ajibawa-2023/Python-Code-Large/train/row_118
14
25
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_118:Import_L1_C0", "label": "re import re, base64, json", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 540, 0, 3, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re", "base64", "json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re, base64, json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L3_C0", "label": "baseurl =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.12, 0.04, 0, 0.66, 0.1667, 660, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "baseurl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "baseurl = \"http://www.ybole.com:81\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L5_C0", "label": "gng_secret =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2, 0.04, 0, 0.66, 0.3333, 656, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "gng_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "gng_secret = \"HUSTGNGisVeryGelivable\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L7_C0", "label": "sina_consumer_key =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.28, 0.04, 0, 0.66, 0.5, 337, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sina_consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sina_consumer_key= \"961495784\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L8_C0", "label": "sina_consumer_secret =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.32, 0.04, 0, 0.66, 0.6667, 444, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sina_consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sina_consumer_secret =\"47d9d806a1dc04cc758be6f7213465bc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "label": "htmlEncode", "type": "function", "loc": [10, 21], "level": 0, "parent": null, "vector": [2, 0, 0.62, 0.48, 0, 0.66, 0.8333, 38, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "htmlEncode", "arg_names": ["str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def htmlEncode(str):\n \"\"\" Returns the HTML encoded version of the given string. This is useful to\n display a plain ASCII text string on a web page.\"\"\"\n htmlCodes = [\n ['&', '&amp;'],\n ['<', '&lt;'],\n ['>', '&gt;'],\n ['\"', '&quot;'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "vector": [8, 1, 0.46, 0.08, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Returns the HTML encoded version of the given string. This is useful to\n display a plain ASCII text string on a web page.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L13_C4", "label": "htmlCodes =", "type": "assigned_variable", "loc": [13, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "vector": [14, 1, 0.62, 0.24, 1, 0.49, 0.3333, 350, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "htmlCodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " htmlCodes = [\n ['&', '&amp;'],\n ['<', '&lt;'],\n ['>', '&gt;'],\n ['\"', '&quot;'],\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:For_L19_C4", "label": "for orig, repl", "type": "for", "loc": [19, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "vector": [6, 1, 0.78, 0.08, 1, 0.49, 0.6667, 603, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "orig, repl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for orig, repl in htmlCodes:\n str = str.replace(orig, repl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L20_C8", "label": "str = replace()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:For_L19_C4", "vector": [14, 2, 0.8, 0.04, 2, 0.63, 0.0, 52, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " str = str.replace(orig, repl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "vector": [13, 1, 0.84, 0.04, 1, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L23_C0", "label": "jsonencode", "type": "function", "loc": [23, 25], "level": 0, "parent": null, "vector": [2, 0, 0.96, 0.12, 0, 0.66, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "jsonencode", "arg_names": ["x"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def jsonencode(x):\n data = dict(x)\n return json.dumps(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L24_C4", "label": "data = dict()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L23_C0", "vector": [14, 1, 0.96, 0.04, 1, 0.15, 0.0, 929, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " data = dict(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_118:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L23_C0", "vector": [13, 1, 1.0, 0.04, 1, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return json.dumps(data)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:For_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Return_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_118:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_118:Return_L25_C4"}]
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. class WeibopError(Exception): """Weibopy exception""" def __init__(self, reason): try: self.reason = reason.encode('utf-8') except: self.reason = reason def __str__(self): return self.reason
ajibawa-2023/Python-Code-Large/train/row_120
8
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_120:ClassDef_L5_C0", "label": "WeibopError", "type": "class", "loc": [5, 15], "level": 0, "parent": null, "vector": [3, 0, 0.625, 0.6875, 0, 0.66, 0.0, 305, 0, 2, 0, 0, 645, 0, 1], "semantic": {"name": "WeibopError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WeibopError(Exception):\n \"\"\"Weibopy exception\"\"\"\n\n def __init__(self, reason):\n try:\n self.reason = reason.encode('utf-8')\n except:\n self.reason = reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "vector": [8, 1, 0.375, 0.0625, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Weibopy exception\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "vector": [2, 1, 0.625, 0.3125, 1, 0.81, 0.5, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "reason"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, reason):\n try:\n self.reason = reason.encode('utf-8')\n except:\n self.reason = reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8", "label": "try", "type": "try", "loc": [9, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L8_C4", "vector": [7, 2, 0.6562, 0.25, 2, 0.21, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.reason = reason.encode('utf-8')\n except:\n self.reason = reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:Assign_L10_C12", "label": "self.reason = encode()", "type": "assigned_variable", "loc": [10, 10], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8", "vector": [14, 3, 0.625, 0.0625, 3, 0.06, 0.0, 831, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "self.reason", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " self.reason = reason.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:Assign_L12_C12", "label": "self.reason =", "type": "assigned_variable", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8", "vector": [14, 3, 0.75, 0.0625, 3, 0.06, 0.0, 831, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.reason", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.reason = reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L14_C4", "label": "__str__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "vector": [2, 1, 0.9062, 0.125, 1, 0.81, 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.reason"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_120:Return_L15_C8", "label": "return", "type": "return", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L14_C4", "vector": [13, 2, 0.9375, 0.0625, 2, 0.18, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.reason"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_120:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_120:Assign_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:Try_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_120:Assign_L12_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_120:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_120:Return_L15_C8"}]
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \ parse_search_datetime, unescape_html class ResultSet(list): """A list like object that holds results from a Twitter API query.""" class Model(object): def __init__(self, api=None): self._api = api def __getstate__(self): # pickle pickle = dict(self.__dict__) del pickle['_api'] # do not pickle the API reference return pickle @classmethod def parse(cls, api, json): """Parse a JSON object into a model instance.""" raise NotImplementedError @classmethod def parse_list(cls, api, json_list): """Parse a list of JSON objects into a result set of model instances.""" results = ResultSet() for obj in json_list: results.append(cls.parse(api, obj)) return results class Status(Model): @classmethod def parse(cls, api, json): status = cls(api) for k, v in json.items(): if k == 'user': user = User.parse(api, v) setattr(status, 'author', user) setattr(status, 'user', user) # DEPRECIATED elif k == 'screen_name': setattr(status, k, v) elif k == 'created_at': setattr(status, k, parse_datetime(v)) elif k == 'source': if '<' in v: setattr(status, k, parse_html_value(v)) setattr(status, 'source_url', parse_a_href(v)) else: setattr(status, k, v) elif k == 'retweeted_status': setattr(status, k, User.parse(api, v)) elif k == 'geo': setattr(status, k, Geo.parse(api, v)) else: setattr(status, k, v) return status def destroy(self): return self._api.destroy_status(self.id) def retweet(self): return self._api.retweet(self.id) def retweets(self): return self._api.retweets(self.id) def favorite(self): return self._api.create_favorite(self.id) class Geo(Model): @classmethod def parse(cls, api, json): geo = cls(api) if json is not None: for k, v in json.items(): setattr(geo, k, v) return geo class Comments(Model): @classmethod def parse(cls, api, json): comments = cls(api) for k, v in json.items(): if k == 'user': user = User.parse(api, v) setattr(comments, 'author', user) setattr(comments, 'user', user) elif k == 'status': status = Status.parse(api, v) setattr(comments, 'user', status) elif k == 'created_at': setattr(comments, k, parse_datetime(v)) elif k == 'reply_comment': setattr(comments, k, User.parse(api, v)) else: setattr(comments, k, v) return comments def destroy(self): return self._api.destroy_status(self.id) def retweet(self): return self._api.retweet(self.id) def retweets(self): return self._api.retweets(self.id) def favorite(self): return self._api.create_favorite(self.id) class User(Model): @classmethod def parse(cls, api, json): user = cls(api) for k, v in json.items(): if k == 'created_at': setattr(user, k, parse_datetime(v)) elif k == 'status': setattr(user, k, Status.parse(api, v)) elif k == 'screen_name': setattr(user, k, v) elif k == 'following': # twitter sets this to null if it is false if v is True: setattr(user, k, True) else: setattr(user, k, False) else: setattr(user, k, v) return user @classmethod def parse_list(cls, api, json_list): if isinstance(json_list, list): item_list = json_list else: item_list = json_list['users'] results = ResultSet() for obj in item_list: results.append(cls.parse(api, obj)) return results def timeline(self, **kargs): return self._api.user_timeline(user_id=self.id, **kargs) def friends(self, **kargs): return self._api.friends(user_id=self.id, **kargs) def followers(self, **kargs): return self._api.followers(user_id=self.id, **kargs) def follow(self): self._api.create_friendship(user_id=self.id) self.following = True def unfollow(self): self._api.destroy_friendship(user_id=self.id) self.following = False def lists_memberships(self, *args, **kargs): return self._api.lists_memberships(user=self.screen_name, *args, **kargs) def lists_subscriptions(self, *args, **kargs): return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs) def lists(self, *args, **kargs): return self._api.lists(user=self.screen_name, *args, **kargs) def followers_ids(self, *args, **kargs): return self._api.followers_ids(user_id=self.id, *args, **kargs) class DirectMessage(Model): @classmethod def parse(cls, api, json): dm = cls(api) for k, v in json.items(): if k == 'sender' or k == 'recipient': setattr(dm, k, User.parse(api, v)) elif k == 'created_at': setattr(dm, k, parse_datetime(v)) else: setattr(dm, k, v) return dm class Friendship(Model): @classmethod def parse(cls, api, json): source = cls(api) for k, v in json['source'].items(): setattr(source, k, v) # parse target target = cls(api) for k, v in json['target'].items(): setattr(target, k, v) return source, target class SavedSearch(Model): @classmethod def parse(cls, api, json): ss = cls(api) for k, v in json.items(): if k == 'created_at': setattr(ss, k, parse_datetime(v)) else: setattr(ss, k, v) return ss def destroy(self): return self._api.destroy_saved_search(self.id) class SearchResult(Model): @classmethod def parse(cls, api, json): result = cls() for k, v in json.items(): if k == 'created_at': setattr(result, k, parse_search_datetime(v)) elif k == 'source': setattr(result, k, parse_html_value(unescape_html(v))) else: setattr(result, k, v) return result @classmethod def parse_list(cls, api, json_list, result_set=None): results = ResultSet() results.max_id = json_list.get('max_id') results.since_id = json_list.get('since_id') results.refresh_url = json_list.get('refresh_url') results.next_page = json_list.get('next_page') results.results_per_page = json_list.get('results_per_page') results.page = json_list.get('page') results.completed_in = json_list.get('completed_in') results.query = json_list.get('query') for obj in json_list['results']: results.append(cls.parse(api, obj)) return results class List(Model): @classmethod def parse(cls, api, json): lst = List(api) for k,v in json.items(): if k == 'user': setattr(lst, k, User.parse(api, v)) else: setattr(lst, k, v) return lst @classmethod def parse_list(cls, api, json_list, result_set=None): results = ResultSet() for obj in json_list['lists']: results.append(cls.parse(api, obj)) return results def update(self, **kargs): return self._api.update_list(self.slug, **kargs) def destroy(self): return self._api.destroy_list(self.slug) def timeline(self, **kargs): return self._api.list_timeline(self.user.screen_name, self.slug, **kargs) def add_member(self, id): return self._api.add_list_member(self.slug, id) def remove_member(self, id): return self._api.remove_list_member(self.slug, id) def members(self, **kargs): return self._api.list_members(self.user.screen_name, self.slug, **kargs) def is_member(self, id): return self._api.is_list_member(self.user.screen_name, self.slug, id) def subscribe(self): return self._api.subscribe_list(self.user.screen_name, self.slug) def unsubscribe(self): return self._api.unsubscribe_list(self.user.screen_name, self.slug) def subscribers(self, **kargs): return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs) def is_subscribed(self, id): return self._api.is_subscribed_list(self.user.screen_name, self.slug, id) class JSONModel(Model): @classmethod def parse(cls, api, json): lst = JSONModel(api) for k,v in json.items(): setattr(lst, k, v) return lst class IDSModel(Model): @classmethod def parse(cls, api, json): ids = IDSModel(api) for k, v in json.items(): setattr(ids, k, v) return ids class Counts(Model): @classmethod def parse(cls, api, json): ids = Counts(api) for k, v in json.items(): setattr(ids, k, v) return ids class ModelFactory(object): """ Used by parsers for creating instances of models. You may subclass this factory to add your own extended models. """ status = Status comments = Comments user = User direct_message = DirectMessage friendship = Friendship saved_search = SavedSearch search_result = SearchResult list = List json = JSONModel ids_list = IDSModel counts = Counts
ajibawa-2023/Python-Code-Large/train/row_121
242
355
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_121:ImportFrom_L5_C0", "label": "from weibopy.utils import parse_datetime, parse_html_value, parse_a_href\u2026", "type": "import", "loc": [5, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0155, 0.0056, 0, 0.66, 0.0, 478, 0, 5, 0, 0, 478, 0, 0], "semantic": {"name": "weibopy.utils", "arg_names": [], "import_names": ["parse_datetime", "parse_html_value", "parse_a_href", "parse_search_datetime", "unescape_html"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.utils import parse_datetime, parse_html_value, parse_a_href, \\\n parse_search_datetime, unescape_html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L8_C0", "label": "ResultSet", "type": "class", "loc": [8, 9], "level": 0, "parent": null, "vector": [3, 0, 0.0239, 0.0056, 0, 0.66, 0.0667, 885, 0, 0, 0, 0, 430, 0, 0], "semantic": {"name": "ResultSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ResultSet(list):\n \"\"\"A list like object that holds results from a Twitter API query.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L8_C0", "vector": [8, 1, 0.0254, 0.0028, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A list like object that holds results from a Twitter API query.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "label": "Model", "type": "class", "loc": [12, 34], "level": 0, "parent": null, "vector": [3, 0, 0.0648, 0.0648, 0, 0.66, 0.1333, 929, 0, 4, 0, 0, 186, 0, 4], "semantic": {"name": "Model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Model(object):\n\n def __init__(self, api=None):\n self._api = api\n\n def __getstate__(self):\n # pickle\n pickle = dict(self.__dict__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "vector": [2, 1, 0.0408, 0.0056, 1, 0.74, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "api"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, api=None):\n self._api = api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L15_C8", "label": "self._api =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L14_C4", "vector": [14, 2, 0.0423, 0.0028, 2, 0.23, 0.0, 806, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._api", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._api = api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4", "label": "__getstate__", "type": "function", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "vector": [2, 1, 0.0535, 0.0141, 1, 0.74, 0.3333, 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 # pickle\n pickle = dict(self.__dict__)\n del pickle['_api'] # do not pickle the API reference\n return pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L19_C8", "label": "pickle = dict()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4", "vector": [14, 2, 0.0535, 0.0028, 2, 0.06, 0.0, 848, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " pickle = dict(self.__dict__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L21_C8", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4", "vector": [13, 2, 0.0592, 0.0028, 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 pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L24_C4", "label": "parse", "type": "function", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "vector": [2, 1, 0.0704, 0.0085, 1, 0.74, 0.6667, 678, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n \"\"\"Parse a JSON object into a model instance.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L25_C8", "label": "expression", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L24_C4", "vector": [8, 2, 0.0704, 0.0028, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse a JSON object into a model instance.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "label": "parse_list", "type": "function", "loc": [29, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "vector": [2, 1, 0.0887, 0.0169, 1, 0.74, 1.0, 887, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list):\n \"\"\"Parse a list of JSON objects into a result set of model instances.\"\"\"\n results = ResultSet()\n for obj in json_list:\n results.append(cls.parse(api, obj))\n return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L30_C8", "label": "expression", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "vector": [8, 2, 0.0845, 0.0028, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse a list of JSON objects into a result set of model instances.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L31_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "vector": [14, 2, 0.0873, 0.0028, 2, 0.14, 0.3333, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L32_C8", "label": "for obj", "type": "for", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "vector": [6, 2, 0.0915, 0.0056, 2, 0.14, 0.6667, 505, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L33_C12", "label": "append()", "type": "expression", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L32_C8", "vector": [8, 3, 0.093, 0.0028, 3, 0.01, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "vector": [13, 2, 0.0958, 0.0028, 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 results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "label": "Status", "type": "class", "loc": [37, 75], "level": 0, "parent": null, "vector": [3, 0, 0.1577, 0.1099, 0, 0.66, 0.2, 820, 0, 5, 0, 0, 929, 0, 22], "semantic": {"name": "Status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Status(Model):\n\n @classmethod\n def parse(cls, api, json):\n status = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "label": "parse", "type": "function", "loc": [40, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "vector": [2, 1, 0.1451, 0.0676, 1, 0.11, 0.0, 678, 0, 3, 1, 0, 0, 0, 18], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n status = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L41_C8", "label": "status = cls()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "vector": [14, 2, 0.1155, 0.0028, 2, 0.69, 0.0, 699, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " status = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L42_C8", "label": "for k, v", "type": "for", "loc": [42, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "vector": [6, 2, 0.1465, 0.0592, 2, 0.69, 0.5, 867, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "label": "if", "type": "if", "loc": [43, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L42_C8", "vector": [4, 3, 0.1479, 0.0563, 3, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n user = User.parse(api, v)\n setattr(status, 'author', user)\n setattr(status, 'user', user) # DEPRECIATED\n elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':\n setattr(status, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L44_C16", "label": "user = parse()", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "vector": [14, 4, 0.1239, 0.0028, 4, 0.33, 0.0, 503, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L45_C16", "label": "setattr()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "vector": [8, 4, 0.1268, 0.0028, 4, 0.33, 0.3333, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'author', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L46_C16", "label": "setattr()", "type": "expression", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "vector": [8, 4, 0.1296, 0.0028, 4, 0.33, 0.6667, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'user', user) # DEPRECIATED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12", "label": "if", "type": "if", "loc": [47, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "vector": [4, 4, 0.1535, 0.0451, 4, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'screen_name':\n setattr(status, k, v)\n elif k == 'created_at':\n setattr(status, k, parse_datetime(v))\n elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L48_C16", "label": "setattr()", "type": "expression", "loc": [48, 48], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12", "vector": [8, 5, 0.1352, 0.0028, 5, 0.0, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12", "label": "if", "type": "if", "loc": [49, 62], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12", "vector": [4, 5, 0.1563, 0.0394, 5, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(status, k, parse_datetime(v))\n elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L50_C16", "label": "setattr()", "type": "expression", "loc": [50, 50], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12", "vector": [8, 6, 0.1408, 0.0028, 6, 0.64, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12", "label": "if", "type": "if", "loc": [51, 62], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12", "vector": [4, 6, 0.1592, 0.0338, 6, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'source':\n if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)\n elif k == 'retweeted_status':\n setattr(status, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "label": "if", "type": "if", "loc": [52, 56], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12", "vector": [4, 7, 0.1521, 0.0141, 7, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '<' in v:\n setattr(status, k, parse_html_value(v))\n setattr(status, 'source_url', parse_a_href(v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L53_C20", "label": "setattr()", "type": "expression", "loc": [53, 53], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "vector": [8, 8, 0.1493, 0.0028, 8, 0.2, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, parse_html_value(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L54_C20", "label": "setattr()", "type": "expression", "loc": [54, 54], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "vector": [8, 8, 0.1521, 0.0028, 8, 0.2, 0.5, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, 'source_url', parse_a_href(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L56_C20", "label": "setattr()", "type": "expression", "loc": [56, 56], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "vector": [8, 8, 0.1577, 0.0028, 8, 0.2, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12", "label": "if", "type": "if", "loc": [57, 62], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12", "vector": [4, 7, 0.1676, 0.0169, 7, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'retweeted_status':\n setattr(status, k, User.parse(api, v))\n elif k == 'geo':\n setattr(status, k, Geo.parse(api, v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L58_C16", "label": "setattr()", "type": "expression", "loc": [58, 58], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12", "vector": [8, 8, 0.1634, 0.0028, 8, 0.52, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12", "label": "if", "type": "if", "loc": [59, 62], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12", "vector": [4, 8, 0.1704, 0.0113, 8, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'geo':\n setattr(status, k, Geo.parse(api, v))\n else:\n setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L60_C16", "label": "setattr()", "type": "expression", "loc": [60, 60], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12", "vector": [8, 9, 0.169, 0.0028, 9, 0.86, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, Geo.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L62_C16", "label": "setattr()", "type": "expression", "loc": [62, 62], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12", "vector": [8, 9, 0.1746, 0.0028, 9, 0.86, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(status, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "vector": [13, 2, 0.1775, 0.0028, 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 status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L65_C4", "label": "destroy", "type": "function", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "vector": [2, 1, 0.1845, 0.0056, 1, 0.11, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L65_C4", "vector": [13, 2, 0.1859, 0.0028, 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._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L68_C4", "label": "retweet", "type": "function", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "vector": [2, 1, 0.193, 0.0056, 1, 0.11, 0.5, 313, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweet(self):\n return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L68_C4", "vector": [13, 2, 0.1944, 0.0028, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L71_C4", "label": "retweets", "type": "function", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "vector": [2, 1, 0.2014, 0.0056, 1, 0.11, 0.75, 728, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweets(self):\n return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L72_C8", "label": "return", "type": "return", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L71_C4", "vector": [13, 2, 0.2028, 0.0028, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L74_C4", "label": "favorite", "type": "function", "loc": [74, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "vector": [2, 1, 0.2099, 0.0056, 1, 0.11, 1.0, 918, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "favorite", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def favorite(self):\n return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L74_C4", "vector": [13, 2, 0.2113, 0.0028, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L76_C0", "label": "Geo", "type": "class", "loc": [76, 84], "level": 0, "parent": null, "vector": [3, 0, 0.2254, 0.0254, 0, 0.66, 0.2667, 734, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "Geo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Geo(Model):\n\n @classmethod\n def parse(cls, api, json):\n geo = cls(api)\n if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "label": "parse", "type": "function", "loc": [79, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L76_C0", "vector": [2, 1, 0.2296, 0.0169, 1, 0.35, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n geo = cls(api)\n if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)\n return geo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L80_C8", "label": "geo = cls()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "vector": [14, 2, 0.2254, 0.0028, 2, 0.88, 0.0, 579, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "geo", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " geo = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L81_C8", "label": "if", "type": "if", "loc": [81, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "vector": [4, 2, 0.231, 0.0085, 2, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if json is not None:\n for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L82_C12", "label": "for k, v", "type": "for", "loc": [82, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L81_C8", "vector": [6, 3, 0.2324, 0.0056, 3, 0.59, 0.0, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L83_C16", "label": "setattr()", "type": "expression", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L82_C12", "vector": [8, 4, 0.2338, 0.0028, 4, 0.96, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(geo, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "vector": [13, 2, 0.2366, 0.0028, 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 geo"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "label": "Comments", "type": "class", "loc": [86, 117], "level": 0, "parent": null, "vector": [3, 0, 0.2859, 0.0901, 0, 0.66, 0.3333, 483, 0, 5, 0, 0, 929, 0, 16], "semantic": {"name": "Comments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Comments(Model):\n\n @classmethod\n def parse(cls, api, json):\n comments = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "label": "parse", "type": "function", "loc": [89, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "vector": [2, 1, 0.2732, 0.0479, 1, 0.61, 0.0, 678, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n comments = cls(api)\n for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L90_C8", "label": "comments = cls()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "vector": [14, 2, 0.2535, 0.0028, 2, 0.96, 0.0, 122, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " comments = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L91_C8", "label": "for k, v", "type": "for", "loc": [91, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "vector": [6, 2, 0.2746, 0.0394, 2, 0.96, 0.5, 867, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "label": "if", "type": "if", "loc": [92, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L91_C8", "vector": [4, 3, 0.2761, 0.0366, 3, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n user = User.parse(api, v)\n setattr(comments, 'author', user)\n setattr(comments, 'user', user)\n elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L93_C16", "label": "user = parse()", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "vector": [14, 4, 0.262, 0.0028, 4, 0.75, 0.0, 503, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " user = User.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L94_C16", "label": "setattr()", "type": "expression", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "vector": [8, 4, 0.2648, 0.0028, 4, 0.75, 0.3333, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'author', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L95_C16", "label": "setattr()", "type": "expression", "loc": [95, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "vector": [8, 4, 0.2676, 0.0028, 4, 0.75, 0.6667, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'user', user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "label": "if", "type": "if", "loc": [96, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "vector": [4, 4, 0.2817, 0.0254, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'status':\n status = Status.parse(api, v)\n setattr(comments, 'user', status)\n elif k == 'created_at':\n setattr(comments, k, parse_datetime(v))\n elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L97_C16", "label": "status = parse()", "type": "assigned_variable", "loc": [97, 97], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "vector": [14, 5, 0.2732, 0.0028, 5, 0.07, 0.0, 699, 3, 2, 0, 0, 678, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " status = Status.parse(api, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L98_C16", "label": "setattr()", "type": "expression", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "vector": [8, 5, 0.2761, 0.0028, 5, 0.07, 0.5, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, 'user', status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12", "label": "if", "type": "if", "loc": [99, 104], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "vector": [4, 5, 0.2859, 0.0169, 5, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(comments, k, parse_datetime(v))\n elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:\n setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L100_C16", "label": "setattr()", "type": "expression", "loc": [100, 100], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12", "vector": [8, 6, 0.2817, 0.0028, 6, 0.49, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12", "label": "if", "type": "if", "loc": [101, 104], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12", "vector": [4, 6, 0.2887, 0.0113, 6, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'reply_comment':\n setattr(comments, k, User.parse(api, v))\n else:\n setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L102_C16", "label": "setattr()", "type": "expression", "loc": [102, 102], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12", "vector": [8, 7, 0.2873, 0.0028, 7, 0.99, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L104_C16", "label": "setattr()", "type": "expression", "loc": [104, 104], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12", "vector": [8, 7, 0.293, 0.0028, 7, 0.99, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(comments, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L105_C8", "label": "return", "type": "return", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "vector": [13, 2, 0.2958, 0.0028, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return comments"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L107_C4", "label": "destroy", "type": "function", "loc": [107, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "vector": [2, 1, 0.3028, 0.0056, 1, 0.61, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L108_C8", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L107_C4", "vector": [13, 2, 0.3042, 0.0028, 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 self._api.destroy_status(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L110_C4", "label": "retweet", "type": "function", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "vector": [2, 1, 0.3113, 0.0056, 1, 0.61, 0.5, 313, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweet(self):\n return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L111_C8", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L110_C4", "vector": [13, 2, 0.3127, 0.0028, 2, 0.78, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweet(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L113_C4", "label": "retweets", "type": "function", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "vector": [2, 1, 0.3197, 0.0056, 1, 0.61, 0.75, 728, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "retweets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def retweets(self):\n return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L113_C4", "vector": [13, 2, 0.3211, 0.0028, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.retweets(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L116_C4", "label": "favorite", "type": "function", "loc": [116, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "vector": [2, 1, 0.3282, 0.0056, 1, 0.61, 1.0, 918, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "favorite", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def favorite(self):\n return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L116_C4", "vector": [13, 2, 0.3296, 0.0028, 2, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.create_favorite(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "label": "User", "type": "class", "loc": [119, 180], "level": 0, "parent": null, "vector": [3, 0, 0.4211, 0.1746, 0, 0.66, 0.4, 61, 0, 11, 0, 0, 929, 0, 23], "semantic": {"name": "User", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class User(Model):\n\n @classmethod\n def parse(cls, api, json):\n user = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "label": "parse", "type": "function", "loc": [122, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.3676, 0.0507, 1, 0.4, 0.0, 678, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n user = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L123_C8", "label": "user = cls()", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "vector": [14, 2, 0.3465, 0.0028, 2, 0.93, 0.0, 503, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " user = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L124_C8", "label": "for k, v", "type": "for", "loc": [124, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "vector": [6, 2, 0.369, 0.0423, 2, 0.93, 0.5, 867, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12", "label": "if", "type": "if", "loc": [125, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L124_C8", "vector": [4, 3, 0.3704, 0.0394, 3, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(user, k, parse_datetime(v))\n elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L126_C16", "label": "setattr()", "type": "expression", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12", "vector": [8, 4, 0.3549, 0.0028, 4, 0.4, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12", "label": "if", "type": "if", "loc": [127, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12", "vector": [4, 4, 0.3732, 0.0338, 4, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'status':\n setattr(user, k, Status.parse(api, v))\n elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L128_C16", "label": "setattr()", "type": "expression", "loc": [128, 128], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12", "vector": [8, 5, 0.3606, 0.0028, 5, 0.48, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, Status.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12", "label": "if", "type": "if", "loc": [129, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12", "vector": [4, 5, 0.3761, 0.0282, 5, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'screen_name':\n setattr(user, k, v)\n elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L130_C16", "label": "setattr()", "type": "expression", "loc": [130, 130], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12", "vector": [8, 6, 0.3662, 0.0028, 6, 0.36, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12", "label": "if", "type": "if", "loc": [131, 138], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12", "vector": [4, 6, 0.3789, 0.0225, 6, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'following':\n # twitter sets this to null if it is false\n if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)\n else:\n setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16", "label": "if", "type": "if", "loc": [133, 136], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12", "vector": [4, 7, 0.3789, 0.0113, 7, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if v is True:\n setattr(user, k, True)\n else:\n setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L134_C20", "label": "setattr()", "type": "expression", "loc": [134, 134], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16", "vector": [8, 8, 0.3775, 0.0028, 8, 0.47, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L136_C20", "label": "setattr()", "type": "expression", "loc": [136, 136], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16", "vector": [8, 8, 0.3831, 0.0028, 8, 0.47, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L138_C16", "label": "setattr()", "type": "expression", "loc": [138, 138], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12", "vector": [8, 7, 0.3887, 0.0028, 7, 0.56, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(user, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "vector": [13, 2, 0.3915, 0.0028, 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 user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "label": "parse_list", "type": "function", "loc": [142, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4127, 0.0282, 1, 0.4, 0.1, 887, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list):\n if isinstance(json_list, list):\n item_list = json_list\n else:\n item_list = json_list['users']\n\n results = ResultSet()\n for obj in item_list:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8", "label": "if", "type": "if", "loc": [143, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "vector": [4, 2, 0.407, 0.0113, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(json_list, list):\n item_list = json_list\n else:\n item_list = json_list['users']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L144_C12", "label": "item_list =", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8", "vector": [14, 3, 0.4056, 0.0028, 3, 0.71, 0.0, 839, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_list = json_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L146_C12", "label": "item_list =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8", "vector": [14, 3, 0.4113, 0.0028, 3, 0.71, 1.0, 839, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_list = json_list['users']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L148_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "vector": [14, 2, 0.4169, 0.0028, 2, 0.96, 0.3333, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L149_C8", "label": "for obj", "type": "for", "loc": [149, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "vector": [6, 2, 0.4211, 0.0056, 2, 0.96, 0.6667, 505, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in item_list:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L150_C12", "label": "append()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L149_C8", "vector": [8, 3, 0.4225, 0.0028, 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": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L151_C8", "label": "return", "type": "return", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "vector": [13, 2, 0.4254, 0.0028, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L153_C4", "label": "timeline", "type": "function", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4324, 0.0056, 1, 0.4, 0.2, 147, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "timeline", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def timeline(self, **kargs):\n return self._api.user_timeline(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L153_C4", "vector": [13, 2, 0.4338, 0.0028, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.user_timeline(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L156_C4", "label": "friends", "type": "function", "loc": [156, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4408, 0.0056, 1, 0.4, 0.3, 875, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "friends", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def friends(self, **kargs):\n return self._api.friends(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L156_C4", "vector": [13, 2, 0.4423, 0.0028, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.friends(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L159_C4", "label": "followers", "type": "function", "loc": [159, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4493, 0.0056, 1, 0.4, 0.4, 530, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "followers", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def followers(self, **kargs):\n return self._api.followers(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L159_C4", "vector": [13, 2, 0.4507, 0.0028, 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._api.followers(user_id=self.id, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4", "label": "follow", "type": "function", "loc": [162, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4592, 0.0085, 1, 0.4, 0.5, 392, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "follow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def follow(self):\n self._api.create_friendship(user_id=self.id)\n self.following = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L163_C8", "label": "create_friendship()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4", "vector": [8, 2, 0.4592, 0.0028, 2, 0.25, 0.0, 536, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "create_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "create_friendship", "annotation": ""}, "snippet": " self._api.create_friendship(user_id=self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L164_C8", "label": "self.following =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4", "vector": [14, 2, 0.462, 0.0028, 2, 0.25, 1.0, 596, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.following", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.following = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4", "label": "unfollow", "type": "function", "loc": [166, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4704, 0.0085, 1, 0.4, 0.6, 515, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unfollow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unfollow(self):\n self._api.destroy_friendship(user_id=self.id)\n self.following = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L167_C8", "label": "destroy_friendship()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4", "vector": [8, 2, 0.4704, 0.0028, 2, 0.27, 0.0, 506, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "destroy_friendship", "arg_names": [], "import_names": [], "rhs_call_name": "destroy_friendship", "annotation": ""}, "snippet": " self._api.destroy_friendship(user_id=self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L168_C8", "label": "self.following =", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4", "vector": [14, 2, 0.4732, 0.0028, 2, 0.27, 1.0, 596, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.following", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.following = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L170_C4", "label": "lists_memberships", "type": "function", "loc": [170, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4803, 0.0056, 1, 0.4, 0.7, 262, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists_memberships", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists_memberships(self, *args, **kargs):\n return self._api.lists_memberships(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L171_C8", "label": "return", "type": "return", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L170_C4", "vector": [13, 2, 0.4817, 0.0028, 2, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists_memberships(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L173_C4", "label": "lists_subscriptions", "type": "function", "loc": [173, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4887, 0.0056, 1, 0.4, 0.8, 33, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists_subscriptions", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists_subscriptions(self, *args, **kargs):\n return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L173_C4", "vector": [13, 2, 0.4901, 0.0028, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists_subscriptions(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L176_C4", "label": "lists", "type": "function", "loc": [176, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.4972, 0.0056, 1, 0.4, 0.9, 194, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "lists", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lists(self, *args, **kargs):\n return self._api.lists(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L177_C8", "label": "return", "type": "return", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L176_C4", "vector": [13, 2, 0.4986, 0.0028, 2, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.lists(user=self.screen_name, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L179_C4", "label": "followers_ids", "type": "function", "loc": [179, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "vector": [2, 1, 0.5056, 0.0056, 1, 0.4, 1.0, 328, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "followers_ids", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def followers_ids(self, *args, **kargs):\n return self._api.followers_ids(user_id=self.id, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L180_C8", "label": "return", "type": "return", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L179_C4", "vector": [13, 2, 0.507, 0.0028, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.followers_ids(user_id=self.id, *args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L185_C0", "label": "DirectMessage", "type": "class", "loc": [185, 196], "level": 0, "parent": null, "vector": [3, 0, 0.5366, 0.0338, 0, 0.66, 0.4667, 693, 0, 1, 0, 0, 929, 0, 7], "semantic": {"name": "DirectMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DirectMessage(Model):\n @classmethod\n def parse(cls, api, json):\n dm = cls(api)\n for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "label": "parse", "type": "function", "loc": [187, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L185_C0", "vector": [2, 1, 0.5394, 0.0282, 1, 0.72, 0.0, 678, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n dm = cls(api)\n for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L188_C8", "label": "dm = cls()", "type": "assigned_variable", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "vector": [14, 2, 0.5296, 0.0028, 2, 0.89, 0.0, 0, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "dm", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " dm = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L189_C8", "label": "for k, v", "type": "for", "loc": [189, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "vector": [6, 2, 0.5408, 0.0197, 2, 0.89, 0.5, 867, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12", "label": "if", "type": "if", "loc": [190, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L189_C8", "vector": [4, 3, 0.5423, 0.0169, 3, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'sender' or k == 'recipient':\n setattr(dm, k, User.parse(api, v))\n elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L191_C16", "label": "setattr()", "type": "expression", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12", "vector": [8, 4, 0.538, 0.0028, 4, 0.56, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12", "label": "if", "type": "if", "loc": [192, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12", "vector": [4, 4, 0.5451, 0.0113, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'created_at':\n setattr(dm, k, parse_datetime(v))\n else:\n setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L193_C16", "label": "setattr()", "type": "expression", "loc": [193, 193], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12", "vector": [8, 5, 0.5437, 0.0028, 5, 0.73, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L195_C16", "label": "setattr()", "type": "expression", "loc": [195, 195], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12", "vector": [8, 5, 0.5493, 0.0028, 5, 0.73, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(dm, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L196_C8", "label": "return", "type": "return", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "vector": [13, 2, 0.5521, 0.0028, 2, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L198_C0", "label": "Friendship", "type": "class", "loc": [198, 212], "level": 0, "parent": null, "vector": [3, 0, 0.5775, 0.0423, 0, 0.66, 0.5333, 401, 0, 1, 0, 0, 929, 0, 6], "semantic": {"name": "Friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Friendship(Model):\n\n @classmethod\n def parse(cls, api, json):\n \n source = cls(api)\n for k, v in json['source'].items():\n setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "label": "parse", "type": "function", "loc": [201, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L198_C0", "vector": [2, 1, 0.5817, 0.0338, 1, 0.36, 0.0, 678, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n \n source = cls(api)\n for k, v in json['source'].items():\n setattr(source, k, v)\n\n # parse target\n target = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L203_C8", "label": "source = cls()", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "vector": [14, 2, 0.5718, 0.0028, 2, 0.64, 0.0, 703, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " source = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L204_C8", "label": "for k, v", "type": "for", "loc": [204, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "vector": [6, 2, 0.5761, 0.0056, 2, 0.64, 0.25, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json['source'].items():\n setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L205_C12", "label": "setattr()", "type": "expression", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L204_C8", "vector": [8, 3, 0.5775, 0.0028, 3, 0.1, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(source, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L208_C8", "label": "target = cls()", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "vector": [14, 2, 0.5859, 0.0028, 2, 0.64, 0.5, 766, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " target = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L209_C8", "label": "for k, v", "type": "for", "loc": [209, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "vector": [6, 2, 0.5901, 0.0056, 2, 0.64, 0.75, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json['target'].items():\n setattr(target, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L210_C12", "label": "setattr()", "type": "expression", "loc": [210, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L209_C8", "vector": [8, 3, 0.5915, 0.0028, 3, 0.11, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(target, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L212_C8", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "vector": [13, 2, 0.5972, 0.0028, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return source, target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L215_C0", "label": "SavedSearch", "type": "class", "loc": [215, 228], "level": 0, "parent": null, "vector": [3, 0, 0.6239, 0.0394, 0, 0.66, 0.6, 895, 0, 2, 0, 0, 929, 0, 6], "semantic": {"name": "SavedSearch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SavedSearch(Model):\n\n @classmethod\n def parse(cls, api, json):\n ss = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "label": "parse", "type": "function", "loc": [218, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L215_C0", "vector": [2, 1, 0.6239, 0.0225, 1, 0.86, 0.0, 678, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ss = cls(api)\n for k, v in json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)\n return ss"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L219_C8", "label": "ss = cls()", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "vector": [14, 2, 0.6169, 0.0028, 2, 0.69, 0.0, 582, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "ss", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " ss = cls(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L220_C8", "label": "for k, v", "type": "for", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "vector": [6, 2, 0.6254, 0.0141, 2, 0.69, 0.5, 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 json.items():\n if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12", "label": "if", "type": "if", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L220_C8", "vector": [4, 3, 0.6268, 0.0113, 3, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(ss, k, parse_datetime(v))\n else:\n setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L222_C16", "label": "setattr()", "type": "expression", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12", "vector": [8, 4, 0.6254, 0.0028, 4, 0.54, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ss, k, parse_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L224_C16", "label": "setattr()", "type": "expression", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12", "vector": [8, 4, 0.631, 0.0028, 4, 0.54, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ss, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "vector": [13, 2, 0.6338, 0.0028, 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 ss"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L227_C4", "label": "destroy", "type": "function", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L215_C0", "vector": [2, 1, 0.6408, 0.0056, 1, 0.86, 1.0, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_saved_search(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L227_C4", "vector": [13, 2, 0.6423, 0.0028, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_saved_search(self.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L231_C0", "label": "SearchResult", "type": "class", "loc": [231, 259], "level": 0, "parent": null, "vector": [3, 0, 0.6901, 0.0817, 0, 0.66, 0.6667, 821, 0, 2, 0, 0, 929, 0, 19], "semantic": {"name": "SearchResult", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SearchResult(Model):\n\n @classmethod\n def parse(cls, api, json):\n result = cls()\n for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "label": "parse", "type": "function", "loc": [234, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L231_C0", "vector": [2, 1, 0.6718, 0.0282, 1, 0.97, 0.0, 678, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n result = cls()\n for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L235_C8", "label": "result = cls()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "vector": [14, 2, 0.662, 0.0028, 2, 0.84, 0.0, 51, 3, 0, 0, 0, 594, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " result = cls()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L236_C8", "label": "for k, v", "type": "for", "loc": [236, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "vector": [6, 2, 0.6732, 0.0197, 2, 0.84, 0.5, 867, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items():\n if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12", "label": "if", "type": "if", "loc": [237, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L236_C8", "vector": [4, 3, 0.6746, 0.0169, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'created_at':\n setattr(result, k, parse_search_datetime(v))\n elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L238_C16", "label": "setattr()", "type": "expression", "loc": [238, 238], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12", "vector": [8, 4, 0.6704, 0.0028, 4, 0.37, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, parse_search_datetime(v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12", "label": "if", "type": "if", "loc": [239, 242], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12", "vector": [4, 4, 0.6775, 0.0113, 4, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k == 'source':\n setattr(result, k, parse_html_value(unescape_html(v)))\n else:\n setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L240_C16", "label": "setattr()", "type": "expression", "loc": [240, 240], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12", "vector": [8, 5, 0.6761, 0.0028, 5, 0.68, 0.0, 501, 3, 3, 0, 0, 0, 0, 3], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, parse_html_value(unescape_html(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L242_C16", "label": "setattr()", "type": "expression", "loc": [242, 242], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12", "vector": [8, 5, 0.6817, 0.0028, 5, 0.68, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(result, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L243_C8", "label": "return", "type": "return", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "vector": [13, 2, 0.6845, 0.0028, 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 result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "label": "parse_list", "type": "function", "loc": [246, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L231_C0", "vector": [2, 1, 0.7113, 0.0394, 1, 0.97, 1.0, 887, 0, 4, 1, 0, 0, 0, 11], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list", "result_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list, result_set=None):\n results = ResultSet()\n results.max_id = json_list.get('max_id')\n results.since_id = json_list.get('since_id')\n results.refresh_url = json_list.get('refresh_url')\n results.next_page = json_list.get('next_page')\n results.results_per_page = json_list.get('results_per_page')\n results.page = json_list.get('page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L247_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.6958, 0.0028, 2, 0.65, 0.0, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L248_C8", "label": "results.max_id = get()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.6986, 0.0028, 2, 0.65, 0.1, 655, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.max_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.max_id = json_list.get('max_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L249_C8", "label": "results.since_id = get()", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7014, 0.0028, 2, 0.65, 0.2, 98, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.since_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.since_id = json_list.get('since_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L250_C8", "label": "results.refresh_url = get()", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7042, 0.0028, 2, 0.65, 0.3, 712, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.refresh_url", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.refresh_url = json_list.get('refresh_url')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L251_C8", "label": "results.next_page = get()", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.707, 0.0028, 2, 0.65, 0.4, 188, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.next_page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.next_page = json_list.get('next_page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L252_C8", "label": "results.results_per_page = get()", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7099, 0.0028, 2, 0.65, 0.5, 28, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.results_per_page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.results_per_page = json_list.get('results_per_page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L253_C8", "label": "results.page = get()", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7127, 0.0028, 2, 0.65, 0.6, 706, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.page = json_list.get('page')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L254_C8", "label": "results.completed_in = get()", "type": "assigned_variable", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7155, 0.0028, 2, 0.65, 0.7, 445, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.completed_in", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.completed_in = json_list.get('completed_in')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L255_C8", "label": "results.query = get()", "type": "assigned_variable", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [14, 2, 0.7183, 0.0028, 2, 0.65, 0.8, 979, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "results.query", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " results.query = json_list.get('query')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L257_C8", "label": "for obj", "type": "for", "loc": [257, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [6, 2, 0.7254, 0.0056, 2, 0.65, 0.9, 505, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list['results']:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L258_C12", "label": "append()", "type": "expression", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L257_C8", "vector": [8, 3, 0.7268, 0.0028, 3, 0.31, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L259_C8", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "vector": [13, 2, 0.7296, 0.0028, 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 results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "label": "List", "type": "class", "loc": [261, 311], "level": 0, "parent": null, "vector": [3, 0, 0.8056, 0.1437, 0, 0.66, 0.7333, 24, 0, 13, 0, 0, 929, 0, 19], "semantic": {"name": "List", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class List(Model):\n\n @classmethod\n def parse(cls, api, json):\n lst = List(api)\n for k,v in json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "label": "parse", "type": "function", "loc": [264, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.7535, 0.0225, 1, 0.09, 0.0, 678, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n lst = List(api)\n for k,v in json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L265_C8", "label": "lst = List()", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "vector": [14, 2, 0.7465, 0.0028, 2, 0.01, 0.0, 564, 3, 1, 0, 0, 24, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "List", "annotation": ""}, "snippet": " lst = List(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L266_C8", "label": "for k, v", "type": "for", "loc": [266, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "vector": [6, 2, 0.7549, 0.0141, 2, 0.01, 0.5, 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 json.items():\n if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12", "label": "if", "type": "if", "loc": [267, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L266_C8", "vector": [4, 3, 0.7563, 0.0113, 3, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'user':\n setattr(lst, k, User.parse(api, v))\n else:\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L268_C16", "label": "setattr()", "type": "expression", "loc": [268, 268], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12", "vector": [8, 4, 0.7549, 0.0028, 4, 0.7, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, User.parse(api, v))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L270_C16", "label": "setattr()", "type": "expression", "loc": [270, 270], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12", "vector": [8, 4, 0.7606, 0.0028, 4, 0.7, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "vector": [13, 2, 0.7634, 0.0028, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "label": "parse_list", "type": "function", "loc": [274, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.7775, 0.0141, 1, 0.09, 0.0833, 887, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "parse_list", "arg_names": ["cls", "api", "json_list", "result_set"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse_list(cls, api, json_list, result_set=None):\n results = ResultSet()\n for obj in json_list['lists']:\n results.append(cls.parse(api, obj))\n return results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L275_C8", "label": "results = ResultSet()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "vector": [14, 2, 0.7746, 0.0028, 2, 0.62, 0.0, 143, 3, 0, 0, 0, 885, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "ResultSet", "annotation": ""}, "snippet": " results = ResultSet()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L276_C8", "label": "for obj", "type": "for", "loc": [276, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "vector": [6, 2, 0.7789, 0.0056, 2, 0.62, 0.5, 505, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in json_list['lists']:\n results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L277_C12", "label": "append()", "type": "expression", "loc": [277, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L276_C8", "vector": [8, 3, 0.7803, 0.0028, 3, 0.77, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " results.append(cls.parse(api, obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L278_C8", "label": "return", "type": "return", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "vector": [13, 2, 0.7831, 0.0028, 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 results"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L280_C4", "label": "update", "type": "function", "loc": [280, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.7901, 0.0056, 1, 0.09, 0.1667, 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 return self._api.update_list(self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L281_C8", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L280_C4", "vector": [13, 2, 0.7915, 0.0028, 2, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.update_list(self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L283_C4", "label": "destroy", "type": "function", "loc": [283, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.7986, 0.0056, 1, 0.09, 0.25, 388, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def destroy(self):\n return self._api.destroy_list(self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L284_C8", "label": "return", "type": "return", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L283_C4", "vector": [13, 2, 0.8, 0.0028, 2, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.destroy_list(self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L286_C4", "label": "timeline", "type": "function", "loc": [286, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.807, 0.0056, 1, 0.09, 0.3333, 147, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "timeline", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def timeline(self, **kargs):\n return self._api.list_timeline(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L287_C8", "label": "return", "type": "return", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L286_C4", "vector": [13, 2, 0.8085, 0.0028, 2, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_timeline(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L289_C4", "label": "add_member", "type": "function", "loc": [289, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8155, 0.0056, 1, 0.09, 0.4167, 837, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_member(self, id):\n return self._api.add_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L290_C8", "label": "return", "type": "return", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L289_C4", "vector": [13, 2, 0.8169, 0.0028, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.add_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L292_C4", "label": "remove_member", "type": "function", "loc": [292, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8239, 0.0056, 1, 0.09, 0.5, 73, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "remove_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_member(self, id):\n return self._api.remove_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L293_C8", "label": "return", "type": "return", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L292_C4", "vector": [13, 2, 0.8254, 0.0028, 2, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.remove_list_member(self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L295_C4", "label": "members", "type": "function", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8324, 0.0056, 1, 0.09, 0.5833, 573, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "members", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def members(self, **kargs):\n return self._api.list_members(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L295_C4", "vector": [13, 2, 0.8338, 0.0028, 2, 0.32, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_members(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L298_C4", "label": "is_member", "type": "function", "loc": [298, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8408, 0.0056, 1, 0.09, 0.6667, 677, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "is_member", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_member(self, id):\n return self._api.is_list_member(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L299_C8", "label": "return", "type": "return", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L298_C4", "vector": [13, 2, 0.8423, 0.0028, 2, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.is_list_member(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L301_C4", "label": "subscribe", "type": "function", "loc": [301, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8493, 0.0056, 1, 0.09, 0.75, 915, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "subscribe", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def subscribe(self):\n return self._api.subscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L302_C8", "label": "return", "type": "return", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L301_C4", "vector": [13, 2, 0.8507, 0.0028, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.subscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L304_C4", "label": "unsubscribe", "type": "function", "loc": [304, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8577, 0.0056, 1, 0.09, 0.8333, 568, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "unsubscribe", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unsubscribe(self):\n return self._api.unsubscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L304_C4", "vector": [13, 2, 0.8592, 0.0028, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.unsubscribe_list(self.user.screen_name, self.slug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L307_C4", "label": "subscribers", "type": "function", "loc": [307, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8662, 0.0056, 1, 0.09, 0.9167, 194, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "subscribers", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def subscribers(self, **kargs):\n return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L308_C8", "label": "return", "type": "return", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L307_C4", "vector": [13, 2, 0.8676, 0.0028, 2, 0.13, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.list_subscribers(self.user.screen_name, self.slug, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L310_C4", "label": "is_subscribed", "type": "function", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "vector": [2, 1, 0.8746, 0.0056, 1, 0.09, 1.0, 863, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "is_subscribed", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_subscribed(self, id):\n return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L311_C8", "label": "return", "type": "return", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L310_C4", "vector": [13, 2, 0.8761, 0.0028, 2, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._api.is_subscribed_list(self.user.screen_name, self.slug, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L313_C0", "label": "JSONModel", "type": "class", "loc": [313, 320], "level": 0, "parent": null, "vector": [3, 0, 0.8915, 0.0225, 0, 0.66, 0.8, 861, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "JSONModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONModel(Model):\n\n @classmethod\n def parse(cls, api, json):\n lst = JSONModel(api)\n for k,v in json.items():\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "label": "parse", "type": "function", "loc": [316, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L313_C0", "vector": [2, 1, 0.8958, 0.0141, 1, 0.9, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n lst = JSONModel(api)\n for k,v in json.items():\n setattr(lst, k, v)\n return lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L317_C8", "label": "lst = JSONModel()", "type": "assigned_variable", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "vector": [14, 2, 0.893, 0.0028, 2, 0.12, 0.0, 564, 3, 1, 0, 0, 861, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "JSONModel", "annotation": ""}, "snippet": " lst = JSONModel(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L318_C8", "label": "for k, v", "type": "for", "loc": [318, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "vector": [6, 2, 0.8972, 0.0056, 2, 0.12, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in json.items():\n setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L319_C12", "label": "setattr()", "type": "expression", "loc": [319, 319], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L318_C8", "vector": [8, 3, 0.8986, 0.0028, 3, 0.11, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(lst, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L320_C8", "label": "return", "type": "return", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "vector": [13, 2, 0.9014, 0.0028, 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 lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L322_C0", "label": "IDSModel", "type": "class", "loc": [322, 328], "level": 0, "parent": null, "vector": [3, 0, 0.9155, 0.0197, 0, 0.66, 0.8667, 955, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "IDSModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IDSModel(Model):\n @classmethod\n def parse(cls, api, json):\n ids = IDSModel(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "label": "parse", "type": "function", "loc": [324, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L322_C0", "vector": [2, 1, 0.9183, 0.0141, 1, 0.69, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ids = IDSModel(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L325_C8", "label": "ids = IDSModel()", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "vector": [14, 2, 0.9155, 0.0028, 2, 0.49, 0.0, 202, 3, 1, 0, 0, 955, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "IDSModel", "annotation": ""}, "snippet": " ids = IDSModel(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L326_C8", "label": "for k, v", "type": "for", "loc": [326, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "vector": [6, 2, 0.9197, 0.0056, 2, 0.49, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items(): \n setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L327_C12", "label": "setattr()", "type": "expression", "loc": [327, 327], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L326_C8", "vector": [8, 3, 0.9211, 0.0028, 3, 0.93, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L328_C8", "label": "return", "type": "return", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "vector": [13, 2, 0.9239, 0.0028, 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 ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L330_C0", "label": "Counts", "type": "class", "loc": [330, 336], "level": 0, "parent": null, "vector": [3, 0, 0.938, 0.0197, 0, 0.66, 0.9333, 731, 0, 1, 0, 0, 929, 0, 3], "semantic": {"name": "Counts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Counts(Model):\n @classmethod\n def parse(cls, api, json):\n ids = Counts(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "label": "parse", "type": "function", "loc": [332, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L330_C0", "vector": [2, 1, 0.9408, 0.0141, 1, 0.3, 0.0, 678, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "parse", "arg_names": ["cls", "api", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(cls, api, json):\n ids = Counts(api)\n for k, v in json.items(): \n setattr(ids, k, v)\n return ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L333_C8", "label": "ids = Counts()", "type": "assigned_variable", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "vector": [14, 2, 0.938, 0.0028, 2, 0.43, 0.0, 202, 3, 1, 0, 0, 731, 10, 1], "semantic": {"name": "ids", "arg_names": [], "import_names": [], "rhs_call_name": "Counts", "annotation": ""}, "snippet": " ids = Counts(api)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:For_L334_C8", "label": "for k, v", "type": "for", "loc": [334, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "vector": [6, 2, 0.9423, 0.0056, 2, 0.43, 0.5, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in json.items(): \n setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L335_C12", "label": "setattr()", "type": "expression", "loc": [335, 335], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:For_L334_C8", "vector": [8, 3, 0.9437, 0.0028, 3, 0.95, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(ids, k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L336_C8", "label": "return", "type": "return", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "vector": [13, 2, 0.9465, 0.0028, 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 ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "label": "ModelFactory", "type": "class", "loc": [338, 355], "level": 0, "parent": null, "vector": [3, 0, 0.9761, 0.0507, 0, 0.66, 1.0, 357, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "ModelFactory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModelFactory(object):\n \"\"\"\n Used by parsers for creating instances\n of models. You may subclass this factory\n to add your own extended models.\n \"\"\"\n\n status = Status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L339_C4", "label": "expression", "type": "expression", "loc": [339, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [8, 1, 0.9606, 0.0141, 1, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Used by parsers for creating instances\n of models. You may subclass this factory\n to add your own extended models.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L345_C4", "label": "status =", "type": "assigned_variable", "loc": [345, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9718, 0.0028, 1, 0.5, 0.0909, 699, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = Status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L346_C4", "label": "comments =", "type": "assigned_variable", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9746, 0.0028, 1, 0.5, 0.1818, 122, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comments = Comments"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L347_C4", "label": "user =", "type": "assigned_variable", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9775, 0.0028, 1, 0.5, 0.2727, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L348_C4", "label": "direct_message =", "type": "assigned_variable", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9803, 0.0028, 1, 0.5, 0.3636, 386, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "direct_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " direct_message = DirectMessage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L349_C4", "label": "friendship =", "type": "assigned_variable", "loc": [349, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9831, 0.0028, 1, 0.5, 0.4545, 778, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendship = Friendship"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L350_C4", "label": "saved_search =", "type": "assigned_variable", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9859, 0.0028, 1, 0.5, 0.5455, 498, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "saved_search", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_search = SavedSearch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L351_C4", "label": "search_result =", "type": "assigned_variable", "loc": [351, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9887, 0.0028, 1, 0.5, 0.6364, 666, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "search_result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " search_result = SearchResult"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L352_C4", "label": "list =", "type": "assigned_variable", "loc": [352, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9915, 0.0028, 1, 0.5, 0.7273, 430, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list = List"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L353_C4", "label": "json =", "type": "assigned_variable", "loc": [353, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9944, 0.0028, 1, 0.5, 0.8182, 463, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = JSONModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L354_C4", "label": "ids_list =", "type": "assigned_variable", "loc": [354, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 0.9972, 0.0028, 1, 0.5, 0.9091, 18, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ids_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ids_list = IDSModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L355_C4", "label": "counts =", "type": "assigned_variable", "loc": [355, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "vector": [14, 1, 1.0, 0.0028, 1, 0.5, 1.0, 560, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counts = Counts"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L48_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L47_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L53_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L54_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L52_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L56_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L59_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L97_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L96_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L126_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L125_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L130_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L129_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L134_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L133_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L136_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L131_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L189_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L192_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L204_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L209_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L210_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L215_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L238_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L237_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L240_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L239_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L242_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L268_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:If_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L270_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L276_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L283_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L286_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L304_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L307_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L318_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L330_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:For_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:For_L334_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L335_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Return_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Expr_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_121:ClassDef_L338_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_121:Assign_L355_C4"}]
""" The MIT License Copyright (c) 2007 Leah Culver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import cgi import urllib import time import random import urlparse import hmac import binascii VERSION = '1.0' # Hi Blaine! HTTP_METHOD = 'GET' SIGNATURE_METHOD = 'PLAINTEXT' class OAuthError(RuntimeError): """Generic exception class.""" def __init__(self, message='OAuth error occured.'): self.message = message def build_authenticate_header(realm=''): """Optional WWW-Authenticate header (401 error)""" return {'WWW-Authenticate': 'OAuth realm="%s"' % realm} def escape(s): """Escape a URL including any /.""" return urllib.quote(s, safe='~') def _utf8_str(s): """Convert unicode to utf-8.""" if isinstance(s, unicode): return s.encode("utf-8") else: return str(s) def generate_timestamp(): """Get seconds since epoch (UTC).""" return int(time.time()) def generate_nonce(length=8): """Generate pseudorandom number.""" return ''.join([str(random.randint(0, 9)) for i in range(length)]) def generate_verifier(length=8): """Generate pseudorandom number.""" return ''.join([str(random.randint(0, 9)) for i in range(length)]) class OAuthConsumer(object): """Consumer of OAuth authentication. OAuthConsumer is a data type that represents the identity of the Consumer via its shared secret with the Service Provider. """ key = None secret = None def __init__(self, key, secret): self.key = key self.secret = secret class OAuthToken(object): """OAuthToken is a data type that represents an End User via either an access or request token. key -- the token secret -- the token secret """ key = None secret = None callback = None callback_confirmed = None verifier = None def __init__(self, key, secret): self.key = key self.secret = secret def set_callback(self, callback): self.callback = callback self.callback_confirmed = 'true' def set_verifier(self, verifier=None): if verifier is not None: self.verifier = verifier else: self.verifier = generate_verifier() def get_callback_url(self): if self.callback and self.verifier: # Append the oauth_verifier. parts = urlparse.urlparse(self.callback) scheme, netloc, path, params, query, fragment = parts[:6] if query: query = '%s&oauth_verifier=%s' % (query, self.verifier) else: query = 'oauth_verifier=%s' % self.verifier return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) return self.callback def to_string(self): data = { 'oauth_token': self.key, 'oauth_token_secret': self.secret, } if self.callback_confirmed is not None: data['oauth_callback_confirmed'] = self.callback_confirmed return urllib.urlencode(data) def from_string(s): """ Returns a token from something like: oauth_token_secret=xxx&oauth_token=xxx """ params = cgi.parse_qs(s, keep_blank_values=False) key = params['oauth_token'][0] secret = params['oauth_token_secret'][0] token = OAuthToken(key, secret) try: token.callback_confirmed = params['oauth_callback_confirmed'][0] except KeyError: pass # 1.0, no callback confirmed. return token from_string = staticmethod(from_string) def __str__(self): return self.to_string() class OAuthRequest(object): """OAuthRequest represents the request and can be serialized. OAuth parameters: - oauth_consumer_key - oauth_token - oauth_signature_method - oauth_signature - oauth_timestamp - oauth_nonce - oauth_version - oauth_verifier ... any additional parameters, as defined by the Service Provider. """ parameters = None # OAuth parameters. http_method = HTTP_METHOD http_url = None version = VERSION def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None): self.http_method = http_method self.http_url = http_url self.parameters = parameters or {} def set_parameter(self, parameter, value): self.parameters[parameter] = value def get_parameter(self, parameter): try: return self.parameters[parameter] except: raise OAuthError('Parameter not found: %s' % parameter) def _get_timestamp_nonce(self): return self.get_parameter('oauth_timestamp'), self.get_parameter( 'oauth_nonce') def get_nonoauth_parameters(self): """Get any non-OAuth parameters.""" parameters = {} for k, v in self.parameters.iteritems(): # Ignore oauth parameters. if k.find('oauth_') < 0: parameters[k] = v return parameters def to_header(self, realm=''): """Serialize as a header for an HTTPAuth request.""" auth_header = 'OAuth realm="%s"' % realm # Add the oauth parameters. if self.parameters: for k, v in self.parameters.iteritems(): if k[:6] == 'oauth_': auth_header += ', %s="%s"' % (k, escape(str(v))) return {'Authorization': auth_header} def to_postdata(self): """Serialize as post data for a POST request.""" return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \ for k, v in self.parameters.iteritems()]) def to_url(self): """Serialize as a URL for a GET request.""" return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata()) def get_normalized_parameters(self): """Return a string that contains the parameters that must be signed.""" params = self.parameters try: # Exclude the signature if it exists. del params['oauth_signature'] except: pass # Escape key values before sorting. key_values = [(escape(_utf8_str(k)), escape(_utf8_str(v))) \ for k,v in params.items()] # Sort lexicographically, first after key, then after value. key_values.sort() # Combine key value pairs into a string. return '&'.join(['%s=%s' % (k, v) for k, v in key_values]) def get_normalized_http_method(self): """Uppercases the http method.""" return self.http_method.upper() def get_normalized_http_url(self): """Parses the URL and rebuilds it to be scheme://host/path.""" parts = urlparse.urlparse(self.http_url) scheme, netloc, path = parts[:3] # Exclude default port numbers. if scheme == 'http' and netloc[-3:] == ':80': netloc = netloc[:-3] elif scheme == 'https' and netloc[-4:] == ':443': netloc = netloc[:-4] return '%s://%s%s' % (scheme, netloc, path) def sign_request(self, signature_method, consumer, token): """Set the signature parameter to the result of build_signature.""" # Set the signature method. self.set_parameter('oauth_signature_method', signature_method.get_name()) # Set the signature. self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token)) def build_signature(self, signature_method, consumer, token): """Calls the build signature method within the signature method.""" return signature_method.build_signature(self, consumer, token) def from_request(http_method, http_url, headers=None, parameters=None, query_string=None): """Combines multiple parameter sources.""" if parameters is None: parameters = {} # Headers if headers and 'Authorization' in headers: auth_header = headers['Authorization'] # Check that the authorization header is OAuth. if auth_header[:6] == 'OAuth ': auth_header = auth_header[6:] try: # Get the parameters from the header. header_params = OAuthRequest._split_header(auth_header) parameters.update(header_params) except: raise OAuthError('Unable to parse OAuth parameters from ' 'Authorization header.') # GET or POST query string. if query_string: query_params = OAuthRequest._split_url_string(query_string) parameters.update(query_params) # URL parameters. param_str = urlparse.urlparse(http_url)[4] # query url_params = OAuthRequest._split_url_string(param_str) parameters.update(url_params) if parameters: return OAuthRequest(http_method, http_url, parameters) return None from_request = staticmethod(from_request) def from_consumer_and_token(oauth_consumer, token=None, callback=None, verifier=None, http_method=HTTP_METHOD, http_url=None, parameters=None): if not parameters: parameters = {} defaults = { 'oauth_consumer_key': oauth_consumer.key, 'oauth_timestamp': generate_timestamp(), 'oauth_nonce': generate_nonce(), 'oauth_version': OAuthRequest.version, } defaults.update(parameters) parameters = defaults if token: parameters['oauth_token'] = token.key if token.callback: parameters['oauth_callback'] = token.callback # 1.0a support for verifier. if verifier: parameters['oauth_verifier'] = verifier elif callback: # 1.0a support for callback in the request token request. parameters['oauth_callback'] = callback return OAuthRequest(http_method, http_url, parameters) from_consumer_and_token = staticmethod(from_consumer_and_token) def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD, http_url=None, parameters=None): if not parameters: parameters = {} parameters['oauth_token'] = token.key if callback: parameters['oauth_callback'] = callback return OAuthRequest(http_method, http_url, parameters) from_token_and_callback = staticmethod(from_token_and_callback) def _split_header(header): """Turn Authorization: header into parameters.""" params = {} parts = header.split(',') for param in parts: # Ignore realm parameter. if param.find('realm') > -1: continue # Remove whitespace. param = param.strip() # Split key-value. param_parts = param.split('=', 1) # Remove quotes and unescape the value. params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\"')) return params _split_header = staticmethod(_split_header) def _split_url_string(param_str): """Turn URL string into parameters.""" parameters = cgi.parse_qs(param_str, keep_blank_values=False) for k, v in parameters.iteritems(): parameters[k] = urllib.unquote(v[0]) return parameters _split_url_string = staticmethod(_split_url_string) class OAuthServer(object): """A worker to check the validity of a request against a data store.""" timestamp_threshold = 300 # In seconds, five minutes. version = VERSION signature_methods = None data_store = None def __init__(self, data_store=None, signature_methods=None): self.data_store = data_store self.signature_methods = signature_methods or {} def set_data_store(self, data_store): self.data_store = data_store def get_data_store(self): return self.data_store def add_signature_method(self, signature_method): self.signature_methods[signature_method.get_name()] = signature_method return self.signature_methods def fetch_request_token(self, oauth_request): """Processes a request_token request and returns the request token on success. """ try: # Get the request token for authorization. token = self._get_token(oauth_request, 'request') except OAuthError: # No token required for the initial token request. version = self._get_version(oauth_request) consumer = self._get_consumer(oauth_request) try: callback = self.get_callback(oauth_request) except OAuthError: callback = None # 1.0, no callback specified. self._check_signature(oauth_request, consumer, None) # Fetch a new token. token = self.data_store.fetch_request_token(consumer, callback) return token def fetch_access_token(self, oauth_request): """Processes an access_token request and returns the access token on success. """ version = self._get_version(oauth_request) consumer = self._get_consumer(oauth_request) try: verifier = self._get_verifier(oauth_request) except OAuthError: verifier = None # Get the request token. token = self._get_token(oauth_request, 'request') self._check_signature(oauth_request, consumer, token) new_token = self.data_store.fetch_access_token(consumer, token, verifier) return new_token def verify_request(self, oauth_request): """Verifies an api call and checks all the parameters.""" # -> consumer and token version = self._get_version(oauth_request) consumer = self._get_consumer(oauth_request) # Get the access token. token = self._get_token(oauth_request, 'access') self._check_signature(oauth_request, consumer, token) parameters = oauth_request.get_nonoauth_parameters() return consumer, token, parameters def authorize_token(self, token, user): """Authorize a request token.""" return self.data_store.authorize_request_token(token, user) def get_callback(self, oauth_request): """Get the callback URL.""" return oauth_request.get_parameter('oauth_callback') def build_authenticate_header(self, realm=''): """Optional support for the authenticate header.""" return {'WWW-Authenticate': 'OAuth realm="%s"' % realm} def _get_version(self, oauth_request): """Verify the correct version request for this server.""" try: version = oauth_request.get_parameter('oauth_version') except: version = VERSION if version and version != self.version: raise OAuthError('OAuth version %s not supported.' % str(version)) return version def _get_signature_method(self, oauth_request): """Figure out the signature with some defaults.""" try: signature_method = oauth_request.get_parameter( 'oauth_signature_method') except: signature_method = SIGNATURE_METHOD try: # Get the signature method object. signature_method = self.signature_methods[signature_method] except: signature_method_names = ', '.join(self.signature_methods.keys()) raise OAuthError('Signature method %s not supported try one of the ' 'following: %s' % (signature_method, signature_method_names)) return signature_method def _get_consumer(self, oauth_request): consumer_key = oauth_request.get_parameter('oauth_consumer_key') consumer = self.data_store.lookup_consumer(consumer_key) if not consumer: raise OAuthError('Invalid consumer.') return consumer def _get_token(self, oauth_request, token_type='access'): """Try to find the token for the provided request token key.""" token_field = oauth_request.get_parameter('oauth_token') token = self.data_store.lookup_token(token_type, token_field) if not token: raise OAuthError('Invalid %s token: %s' % (token_type, token_field)) return token def _get_verifier(self, oauth_request): return oauth_request.get_parameter('oauth_verifier') def _check_signature(self, oauth_request, consumer, token): timestamp, nonce = oauth_request._get_timestamp_nonce() self._check_timestamp(timestamp) self._check_nonce(consumer, token, nonce) signature_method = self._get_signature_method(oauth_request) try: signature = oauth_request.get_parameter('oauth_signature') except: raise OAuthError('Missing signature.') # Validate the signature. valid_sig = signature_method.check_signature(oauth_request, consumer, token, signature) if not valid_sig: key, base = signature_method.build_signature_base_string( oauth_request, consumer, token) raise OAuthError('Invalid signature. Expected signature base ' 'string: %s' % base) built = signature_method.build_signature(oauth_request, consumer, token) def _check_timestamp(self, timestamp): """Verify that timestamp is recentish.""" timestamp = int(timestamp) now = int(time.time()) lapsed = abs(now - timestamp) if lapsed > self.timestamp_threshold: raise OAuthError('Expired timestamp: given %d and now %s has a ' 'greater difference than threshold %d' % (timestamp, now, self.timestamp_threshold)) def _check_nonce(self, consumer, token, nonce): """Verify that the nonce is uniqueish.""" nonce = self.data_store.lookup_nonce(consumer, token, nonce) if nonce: raise OAuthError('Nonce already used: %s' % str(nonce)) class OAuthClient(object): """OAuthClient is a worker to attempt to execute a request.""" consumer = None token = None def __init__(self, oauth_consumer, oauth_token): self.consumer = oauth_consumer self.token = oauth_token def get_consumer(self): return self.consumer def get_token(self): return self.token def fetch_request_token(self, oauth_request): """-> OAuthToken.""" raise NotImplementedError def fetch_access_token(self, oauth_request): """-> OAuthToken.""" raise NotImplementedError def access_resource(self, oauth_request): """-> Some protected resource.""" raise NotImplementedError class OAuthDataStore(object): """A database abstraction used to lookup consumers and tokens.""" def lookup_consumer(self, key): """-> OAuthConsumer.""" raise NotImplementedError def lookup_token(self, oauth_consumer, token_type, token_token): """-> OAuthToken.""" raise NotImplementedError def lookup_nonce(self, oauth_consumer, oauth_token, nonce): """-> OAuthToken.""" raise NotImplementedError def fetch_request_token(self, oauth_consumer, oauth_callback): """-> OAuthToken.""" raise NotImplementedError def fetch_access_token(self, oauth_consumer, oauth_token, oauth_verifier): """-> OAuthToken.""" raise NotImplementedError def authorize_request_token(self, oauth_token, user): """-> OAuthToken.""" raise NotImplementedError class OAuthSignatureMethod(object): """A strategy class that implements a signature method.""" def get_name(self): """-> str.""" raise NotImplementedError def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token): """-> str key, str raw.""" raise NotImplementedError def build_signature(self, oauth_request, oauth_consumer, oauth_token): """-> str.""" raise NotImplementedError def check_signature(self, oauth_request, consumer, token, signature): built = self.build_signature(oauth_request, consumer, token) return built == signature class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod): def get_name(self): return 'HMAC-SHA1' def build_signature_base_string(self, oauth_request, consumer, token): sig = ( escape(oauth_request.get_normalized_http_method()), escape(oauth_request.get_normalized_http_url()), escape(oauth_request.get_normalized_parameters()), ) key = '%s&' % escape(consumer.secret) if token: key += escape(token.secret) #print "OAuth base string:" + str(sig) raw = '&'.join(sig) return key, raw def build_signature(self, oauth_request, consumer, token): """Builds the base signature string.""" key, raw = self.build_signature_base_string(oauth_request, consumer, token) # HMAC object. try: import hashlib # 2.5 hashed = hmac.new(key, raw, hashlib.sha1) except: import sha # Deprecated hashed = hmac.new(key, raw, sha) # Calculate the digest base 64. return binascii.b2a_base64(hashed.digest())[:-1] class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod): def get_name(self): return 'PLAINTEXT' def build_signature_base_string(self, oauth_request, consumer, token): """Concatenates the consumer key and secret.""" sig = '%s&' % escape(consumer.secret) if token: sig = sig + escape(token.secret) return sig, sig def build_signature(self, oauth_request, consumer, token): key, raw = self.build_signature_base_string(oauth_request, consumer, token) return key
ajibawa-2023/Python-Code-Large/train/row_122
389
654
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0183, 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": "\"\"\"\nThe MIT License\n\nCopyright (c) 2007 Leah Culver\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L25_C0", "label": "cgi import cgi", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0382, 0.0015, 0, 0.66, 0.0385, 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_122:Import_L26_C0", "label": "urllib import urllib", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0398, 0.0015, 0, 0.66, 0.0769, 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_122:Import_L27_C0", "label": "time import time", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0413, 0.0015, 0, 0.66, 0.1154, 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_122:Import_L28_C0", "label": "random import random", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0428, 0.0015, 0, 0.66, 0.1538, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L29_C0", "label": "urlparse import urlparse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0443, 0.0015, 0, 0.66, 0.1923, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L30_C0", "label": "hmac import hmac", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.0459, 0.0015, 0, 0.66, 0.2308, 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_122:Import_L31_C0", "label": "binascii import binascii", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.0474, 0.0015, 0, 0.66, 0.2692, 984, 0, 1, 0, 0, 984, 0, 0], "semantic": {"name": "binascii", "arg_names": [], "import_names": ["binascii"], "rhs_call_name": "", "annotation": ""}, "snippet": "import binascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L34_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.052, 0.0015, 0, 0.66, 0.3077, 557, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION = '1.0' # Hi Blaine!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L35_C0", "label": "HTTP_METHOD =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.0535, 0.0015, 0, 0.66, 0.3462, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "HTTP_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HTTP_METHOD = 'GET'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L36_C0", "label": "SIGNATURE_METHOD =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.055, 0.0015, 0, 0.66, 0.3846, 339, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNATURE_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNATURE_METHOD = 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L39_C0", "label": "OAuthError", "type": "class", "loc": [39, 42], "level": 0, "parent": null, "vector": [3, 0, 0.0619, 0.0061, 0, 0.66, 0.4231, 899, 0, 1, 0, 0, 178, 0, 0], "semantic": {"name": "OAuthError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthError(RuntimeError):\n \"\"\"Generic exception class.\"\"\"\n def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L39_C0", "vector": [8, 1, 0.0612, 0.0015, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generic exception class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L41_C4", "label": "__init__", "type": "function", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L39_C0", "vector": [2, 1, 0.0635, 0.0031, 1, 0.28, 1.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L42_C8", "label": "self.message =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L41_C4", "vector": [14, 2, 0.0642, 0.0015, 2, 0.3, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L44_C0", "label": "build_authenticate_header", "type": "function", "loc": [44, 46], "level": 0, "parent": null, "vector": [2, 0, 0.0688, 0.0046, 0, 0.66, 0.4615, 279, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def build_authenticate_header(realm=''):\n \"\"\"Optional WWW-Authenticate header (401 error)\"\"\"\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L45_C4", "label": "expression", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L44_C0", "vector": [8, 1, 0.0688, 0.0015, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Optional WWW-Authenticate header (401 error)\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L46_C4", "label": "return", "type": "return", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L44_C0", "vector": [13, 1, 0.0703, 0.0015, 1, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L48_C0", "label": "escape", "type": "function", "loc": [48, 50], "level": 0, "parent": null, "vector": [2, 0, 0.0749, 0.0046, 0, 0.66, 0.5, 494, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "escape", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(s):\n \"\"\"Escape a URL including any /.\"\"\"\n return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L49_C4", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L48_C0", "vector": [8, 1, 0.0749, 0.0015, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Escape a URL including any /.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L48_C0", "vector": [13, 1, 0.0765, 0.0015, 1, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L52_C0", "label": "_utf8_str", "type": "function", "loc": [52, 57], "level": 0, "parent": null, "vector": [2, 0, 0.0833, 0.0092, 0, 0.66, 0.5385, 730, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_utf8_str", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _utf8_str(s):\n \"\"\"Convert unicode to utf-8.\"\"\"\n if isinstance(s, unicode):\n return s.encode(\"utf-8\")\n else:\n return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L52_C0", "vector": [8, 1, 0.081, 0.0015, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convert unicode to utf-8.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4", "label": "if", "type": "if", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L52_C0", "vector": [4, 1, 0.0849, 0.0061, 1, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, unicode):\n return s.encode(\"utf-8\")\n else:\n return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4", "vector": [13, 2, 0.0841, 0.0015, 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 s.encode(\"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L57_C8", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4", "vector": [13, 2, 0.0872, 0.0015, 2, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L59_C0", "label": "generate_timestamp", "type": "function", "loc": [59, 61], "level": 0, "parent": null, "vector": [2, 0, 0.0917, 0.0046, 0, 0.66, 0.5769, 54, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "generate_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_timestamp():\n \"\"\"Get seconds since epoch (UTC).\"\"\"\n return int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L60_C4", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L59_C0", "vector": [8, 1, 0.0917, 0.0015, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get seconds since epoch (UTC).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L59_C0", "vector": [13, 1, 0.0933, 0.0015, 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 int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L63_C0", "label": "generate_nonce", "type": "function", "loc": [63, 65], "level": 0, "parent": null, "vector": [2, 0, 0.0979, 0.0046, 0, 0.66, 0.6154, 53, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "generate_nonce", "arg_names": ["length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_nonce(length=8):\n \"\"\"Generate pseudorandom number.\"\"\"\n return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L64_C4", "label": "expression", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L63_C0", "vector": [8, 1, 0.0979, 0.0015, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generate pseudorandom number.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L63_C0", "vector": [13, 1, 0.0994, 0.0015, 1, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L67_C0", "label": "generate_verifier", "type": "function", "loc": [67, 69], "level": 0, "parent": null, "vector": [2, 0, 0.104, 0.0046, 0, 0.66, 0.6538, 126, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "generate_verifier", "arg_names": ["length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_verifier(length=8):\n \"\"\"Generate pseudorandom number.\"\"\"\n return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L67_C0", "vector": [8, 1, 0.104, 0.0015, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Generate pseudorandom number.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L69_C4", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L67_C0", "vector": [13, 1, 0.1055, 0.0015, 1, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join([str(random.randint(0, 9)) for i in range(length)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "label": "OAuthConsumer", "type": "class", "loc": [72, 84], "level": 0, "parent": null, "vector": [3, 0, 0.1193, 0.0199, 0, 0.66, 0.6923, 660, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthConsumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthConsumer(object):\n \"\"\"Consumer of OAuth authentication.\n\n OAuthConsumer is a data type that represents the identity of the Consumer\n via its shared secret with the Service Provider.\n\n \"\"\"\n key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L73_C4", "label": "expression", "type": "expression", "loc": [73, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "vector": [8, 1, 0.1154, 0.0092, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Consumer of OAuth authentication.\n\n OAuthConsumer is a data type that represents the identity of the Consumer\n via its shared secret with the Service Provider.\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L79_C4", "label": "key =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "vector": [14, 1, 0.1208, 0.0015, 1, 0.53, 0.3333, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L80_C4", "label": "secret =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "vector": [14, 1, 0.1223, 0.0015, 1, 0.53, 0.6667, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4", "label": "__init__", "type": "function", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "vector": [2, 1, 0.1269, 0.0046, 1, 0.53, 1.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L83_C8", "label": "self.key =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4", "vector": [14, 2, 0.1269, 0.0015, 2, 0.3, 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_122:Assign_L84_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4", "vector": [14, 2, 0.1284, 0.0015, 2, 0.3, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "label": "OAuthToken", "type": "class", "loc": [87, 153], "level": 0, "parent": null, "vector": [3, 0, 0.1835, 0.1024, 0, 0.66, 0.7308, 512, 0, 7, 0, 0, 186, 0, 8], "semantic": {"name": "OAuthToken", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthToken(object):\n \"\"\"OAuthToken is a data type that represents an End User via either an access\n or request token.\n \n key -- the token\n secret -- the token secret\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L88_C4", "label": "expression", "type": "expression", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [8, 1, 0.1391, 0.0107, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthToken is a data type that represents an End User via either an access\n or request token.\n \n key -- the token\n secret -- the token secret\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L95_C4", "label": "key =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.1453, 0.0015, 1, 0.57, 0.0769, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L96_C4", "label": "secret =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.1468, 0.0015, 1, 0.57, 0.1538, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L97_C4", "label": "callback =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.1483, 0.0015, 1, 0.57, 0.2308, 342, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L98_C4", "label": "callback_confirmed =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.1498, 0.0015, 1, 0.57, 0.3077, 187, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback_confirmed = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L99_C4", "label": "verifier =", "type": "assigned_variable", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.1514, 0.0015, 1, 0.57, 0.3846, 629, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4", "label": "__init__", "type": "function", "loc": [101, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.156, 0.0046, 1, 0.57, 0.4615, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L102_C8", "label": "self.key =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4", "vector": [14, 2, 0.156, 0.0015, 2, 0.83, 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_122:Assign_L103_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4", "vector": [14, 2, 0.1575, 0.0015, 2, 0.83, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4", "label": "set_callback", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.1621, 0.0046, 1, 0.57, 0.5385, 990, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_callback", "arg_names": ["self", "callback"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_callback(self, callback):\n self.callback = callback\n self.callback_confirmed = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L106_C8", "label": "self.callback =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4", "vector": [14, 2, 0.1621, 0.0015, 2, 0.0, 0.0, 236, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callback = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L107_C8", "label": "self.callback_confirmed =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4", "vector": [14, 2, 0.1636, 0.0015, 2, 0.0, 1.0, 513, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.callback_confirmed = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L109_C4", "label": "set_verifier", "type": "function", "loc": [109, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.1697, 0.0076, 1, 0.57, 0.6154, 943, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_verifier", "arg_names": ["self", "verifier"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_verifier(self, verifier=None):\n if verifier is not None:\n self.verifier = verifier\n else:\n self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8", "label": "if", "type": "if", "loc": [110, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L109_C4", "vector": [4, 2, 0.1705, 0.0061, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if verifier is not None:\n self.verifier = verifier\n else:\n self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L111_C12", "label": "self.verifier =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8", "vector": [14, 3, 0.1697, 0.0015, 3, 0.26, 0.0, 54, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.verifier = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L113_C12", "label": "self.verifier = generate_verifier()", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8", "vector": [14, 3, 0.1728, 0.0015, 3, 0.26, 1.0, 54, 3, 0, 0, 0, 126, 10, 1], "semantic": {"name": "self.verifier", "arg_names": [], "import_names": [], "rhs_call_name": "generate_verifier", "annotation": ""}, "snippet": " self.verifier = generate_verifier()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4", "label": "get_callback_url", "type": "function", "loc": [115, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.1843, 0.0183, 1, 0.57, 0.6923, 417, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_callback_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_callback_url(self):\n if self.callback and self.verifier:\n # Append the oauth_verifier.\n parts = urlparse.urlparse(self.callback)\n scheme, netloc, path, params, query, fragment = parts[:6]\n if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "label": "if", "type": "if", "loc": [116, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4", "vector": [4, 2, 0.1843, 0.0153, 2, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.callback and self.verifier:\n # Append the oauth_verifier.\n parts = urlparse.urlparse(self.callback)\n scheme, netloc, path, params, query, fragment = parts[:6]\n if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:\n query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L118_C12", "label": "parts = urlparse()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "vector": [14, 3, 0.1804, 0.0015, 3, 0.35, 0.0, 13, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parts = urlparse.urlparse(self.callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L119_C12", "label": "scheme, netloc, path, params, query, fragment =", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "vector": [14, 3, 0.182, 0.0015, 3, 0.35, 0.3333, 3, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scheme, netloc, path, params, query, fragment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme, netloc, path, params, query, fragment = parts[:6]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12", "label": "if", "type": "if", "loc": [120, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "vector": [4, 3, 0.1858, 0.0061, 3, 0.35, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if query:\n query = '%s&oauth_verifier=%s' % (query, self.verifier)\n else:\n query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L121_C16", "label": "query =", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12", "vector": [14, 4, 0.185, 0.0015, 4, 0.05, 0.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = '%s&oauth_verifier=%s' % (query, self.verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L123_C16", "label": "query =", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12", "vector": [14, 4, 0.1881, 0.0015, 4, 0.05, 1.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = 'oauth_verifier=%s' % self.verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L124_C12", "label": "return", "type": "return", "loc": [124, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "vector": [13, 3, 0.1904, 0.0031, 3, 0.35, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urlparse.urlunparse((scheme, netloc, path, params,\n query, fragment))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4", "vector": [13, 2, 0.1927, 0.0015, 2, 0.55, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "label": "to_string", "type": "function", "loc": [128, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.2011, 0.0122, 1, 0.57, 0.7692, 549, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "to_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_string(self):\n data = {\n 'oauth_token': self.key,\n 'oauth_token_secret': self.secret,\n }\n if self.callback_confirmed is not None:\n data['oauth_callback_confirmed'] = self.callback_confirmed\n return urllib.urlencode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L129_C8", "label": "data =", "type": "assigned_variable", "loc": [129, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "vector": [14, 2, 0.1995, 0.0061, 2, 0.83, 0.0, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {\n 'oauth_token': self.key,\n 'oauth_token_secret': self.secret,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L133_C8", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "vector": [4, 2, 0.2041, 0.0031, 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 self.callback_confirmed is not None:\n data['oauth_callback_confirmed'] = self.callback_confirmed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L134_C12", "label": "assign", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L133_C8", "vector": [14, 3, 0.2049, 0.0015, 3, 0.14, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data['oauth_callback_confirmed'] = self.callback_confirmed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "vector": [13, 2, 0.2064, 0.0015, 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 urllib.urlencode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "label": "from_string", "type": "function", "loc": [137, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.2187, 0.0199, 1, 0.57, 0.8462, 423, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "from_string", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_string(s):\n \"\"\" Returns a token from something like:\n oauth_token_secret=xxx&oauth_token=xxx\n \"\"\"\n params = cgi.parse_qs(s, keep_blank_values=False)\n key = params['oauth_token'][0]\n secret = params['oauth_token_secret'][0]\n token = OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L138_C8", "label": "expression", "type": "expression", "loc": [138, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [8, 2, 0.2125, 0.0046, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Returns a token from something like:\n oauth_token_secret=xxx&oauth_token=xxx\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L141_C8", "label": "params = parse_qs()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [14, 2, 0.2156, 0.0015, 2, 0.54, 0.1667, 206, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " params = cgi.parse_qs(s, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L142_C8", "label": "key =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [14, 2, 0.2171, 0.0015, 2, 0.54, 0.3333, 230, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = params['oauth_token'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L143_C8", "label": "secret =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [14, 2, 0.2187, 0.0015, 2, 0.54, 0.5, 189, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = params['oauth_token_secret'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L144_C8", "label": "token = OAuthToken()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [14, 2, 0.2202, 0.0015, 2, 0.54, 0.6667, 129, 3, 2, 0, 0, 512, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthToken", "annotation": ""}, "snippet": " token = OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L145_C8", "label": "try", "type": "try", "loc": [145, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [7, 2, 0.224, 0.0061, 2, 0.54, 0.8333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n token.callback_confirmed = params['oauth_callback_confirmed'][0]\n except KeyError:\n pass # 1.0, no callback confirmed."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L146_C12", "label": "token.callback_confirmed =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L145_C8", "vector": [14, 3, 0.2232, 0.0015, 3, 0.86, 0.0, 684, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "token.callback_confirmed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token.callback_confirmed = params['oauth_callback_confirmed'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L149_C8", "label": "return", "type": "return", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "vector": [13, 2, 0.2278, 0.0015, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L150_C4", "label": "from_string = staticmethod()", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [14, 1, 0.2294, 0.0015, 1, 0.57, 0.9231, 423, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_string", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_string = staticmethod(from_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L152_C4", "label": "__str__", "type": "function", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "vector": [2, 1, 0.2332, 0.0031, 1, 0.57, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L153_C8", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L152_C4", "vector": [13, 2, 0.2339, 0.0015, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "label": "OAuthRequest", "type": "class", "loc": [156, 365], "level": 0, "parent": null, "vector": [3, 0, 0.3983, 0.3211, 0, 0.66, 0.7692, 101, 0, 18, 0, 0, 186, 0, 58], "semantic": {"name": "OAuthRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthRequest(object):\n \"\"\"OAuthRequest represents the request and can be serialized.\n\n OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L157_C4", "label": "expression", "type": "expression", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [8, 1, 0.2492, 0.0199, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthRequest represents the request and can be serialized.\n\n OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature \n - oauth_timestamp "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L170_C4", "label": "parameters =", "type": "assigned_variable", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.2599, 0.0015, 1, 0.04, 0.037, 29, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = None # OAuth parameters."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L171_C4", "label": "http_method =", "type": "assigned_variable", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.2615, 0.0015, 1, 0.04, 0.0741, 19, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_method = HTTP_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L172_C4", "label": "http_url =", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.263, 0.0015, 1, 0.04, 0.1111, 630, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_url = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L173_C4", "label": "version =", "type": "assigned_variable", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.2645, 0.0015, 1, 0.04, 0.1481, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "label": "__init__", "type": "function", "loc": [175, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.2699, 0.0061, 1, 0.04, 0.1852, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None):\n self.http_method = http_method\n self.http_url = http_url\n self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L176_C8", "label": "self.http_method =", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "vector": [14, 2, 0.2691, 0.0015, 2, 0.19, 0.0, 758, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_method = http_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L177_C8", "label": "self.http_url =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "vector": [14, 2, 0.2706, 0.0015, 2, 0.19, 0.5, 654, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_url = http_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L178_C8", "label": "self.parameters =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "vector": [14, 2, 0.2722, 0.0015, 2, 0.19, 1.0, 721, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L179_C4", "label": "set_parameter", "type": "function", "loc": [179, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.2745, 0.0031, 1, 0.04, 0.2222, 310, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "set_parameter", "arg_names": ["self", "parameter", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_parameter(self, parameter, value):\n self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L180_C8", "label": "assign", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L179_C4", "vector": [14, 2, 0.2752, 0.0015, 2, 0.78, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L182_C4", "label": "get_parameter", "type": "function", "loc": [182, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.2813, 0.0076, 1, 0.04, 0.2593, 386, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_parameter", "arg_names": ["self", "parameter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_parameter(self, parameter):\n try:\n return self.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L183_C8", "label": "try", "type": "try", "loc": [183, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L182_C4", "vector": [7, 2, 0.2821, 0.0061, 2, 0.14, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L184_C12", "label": "return", "type": "return", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L183_C8", "vector": [13, 3, 0.2813, 0.0015, 3, 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.parameters[parameter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L188_C4", "label": "_get_timestamp_nonce", "type": "function", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.289, 0.0046, 1, 0.04, 0.2963, 211, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "_get_timestamp_nonce", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_timestamp_nonce(self):\n return self.get_parameter('oauth_timestamp'), self.get_parameter(\n 'oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L189_C8", "label": "return", "type": "return", "loc": [189, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L188_C4", "vector": [13, 2, 0.2898, 0.0031, 2, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_parameter('oauth_timestamp'), self.get_parameter(\n 'oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "label": "get_nonoauth_parameters", "type": "function", "loc": [192, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.2989, 0.0122, 1, 0.04, 0.3333, 748, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_nonoauth_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_nonoauth_parameters(self):\n \"\"\"Get any non-OAuth parameters.\"\"\"\n parameters = {}\n for k, v in self.parameters.iteritems():\n # Ignore oauth parameters.\n if k.find('oauth_') < 0:\n parameters[k] = v\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L193_C8", "label": "expression", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "vector": [8, 2, 0.2951, 0.0015, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get any non-OAuth parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L194_C8", "label": "parameters =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "vector": [14, 2, 0.2966, 0.0015, 2, 0.27, 0.3333, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:For_L195_C8", "label": "for k, v", "type": "for", "loc": [195, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "vector": [6, 2, 0.3005, 0.0061, 2, 0.27, 0.6667, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.parameters.iteritems():\n # Ignore oauth parameters.\n if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L197_C12", "label": "if", "type": "if", "loc": [197, 198], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L195_C8", "vector": [4, 3, 0.302, 0.0031, 3, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L198_C16", "label": "assign", "type": "assigned_variable", "loc": [198, 198], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L197_C12", "vector": [14, 4, 0.3028, 0.0015, 4, 0.96, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L199_C8", "label": "return", "type": "return", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "vector": [13, 2, 0.3043, 0.0015, 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 parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "label": "to_header", "type": "function", "loc": [201, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3135, 0.0138, 1, 0.04, 0.3704, 578, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "to_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_header(self, realm=''):\n \"\"\"Serialize as a header for an HTTPAuth request.\"\"\"\n auth_header = 'OAuth realm=\"%s\"' % realm\n # Add the oauth parameters.\n if self.parameters:\n for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L202_C8", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "vector": [8, 2, 0.3089, 0.0015, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as a header for an HTTPAuth request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L203_C8", "label": "auth_header =", "type": "assigned_variable", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "vector": [14, 2, 0.3104, 0.0015, 2, 0.91, 0.3333, 774, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = 'OAuth realm=\"%s\"' % realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L205_C8", "label": "if", "type": "if", "loc": [205, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "vector": [4, 2, 0.3157, 0.0061, 2, 0.91, 0.6667, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parameters:\n for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:For_L206_C12", "label": "for k, v", "type": "for", "loc": [206, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L205_C8", "vector": [6, 3, 0.3165, 0.0046, 3, 0.5, 0.0, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.parameters.iteritems():\n if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L207_C16", "label": "if", "type": "if", "loc": [207, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L206_C12", "vector": [4, 4, 0.3173, 0.0031, 4, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k[:6] == 'oauth_':\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L209_C8", "label": "return", "type": "return", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "vector": [13, 2, 0.3196, 0.0015, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'Authorization': auth_header}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4", "label": "to_postdata", "type": "function", "loc": [211, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3249, 0.0061, 1, 0.04, 0.4074, 745, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "to_postdata", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_postdata(self):\n \"\"\"Serialize as post data for a POST request.\"\"\"\n return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \\\n for k, v in self.parameters.iteritems()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L212_C8", "label": "expression", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4", "vector": [8, 2, 0.3242, 0.0015, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as post data for a POST request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L213_C8", "label": "return", "type": "return", "loc": [213, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4", "vector": [13, 2, 0.3265, 0.0031, 2, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \\\n for k, v in self.parameters.iteritems()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4", "label": "to_url", "type": "function", "loc": [216, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3318, 0.0046, 1, 0.04, 0.4444, 212, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "to_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_url(self):\n \"\"\"Serialize as a URL for a GET request.\"\"\"\n return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L217_C8", "label": "expression", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4", "vector": [8, 2, 0.3318, 0.0015, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize as a URL for a GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L218_C8", "label": "return", "type": "return", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4", "vector": [13, 2, 0.3333, 0.0015, 2, 0.94, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "label": "get_normalized_parameters", "type": "function", "loc": [220, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3471, 0.0229, 1, 0.04, 0.4815, 230, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_normalized_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_parameters(self):\n \"\"\"Return a string that contains the parameters that must be signed.\"\"\"\n params = self.parameters\n try:\n # Exclude the signature if it exists.\n del params['oauth_signature']\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L221_C8", "label": "expression", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [8, 2, 0.3379, 0.0015, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a string that contains the parameters that must be signed.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L222_C8", "label": "params =", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [14, 2, 0.3394, 0.0015, 2, 0.63, 0.2, 206, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = self.parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L223_C8", "label": "try", "type": "try", "loc": [223, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [7, 2, 0.344, 0.0076, 2, 0.63, 0.4, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Exclude the signature if it exists.\n del params['oauth_signature']\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L229_C8", "label": "key_values =", "type": "assigned_variable", "loc": [229, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [14, 2, 0.3509, 0.0031, 2, 0.63, 0.6, 287, 5, 0, 0, 0, 0, 0, 5], "semantic": {"name": "key_values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_values = [(escape(_utf8_str(k)), escape(_utf8_str(v))) \\\n for k,v in params.items()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L232_C8", "label": "sort()", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [8, 2, 0.3547, 0.0015, 2, 0.63, 0.8, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " key_values.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L234_C8", "label": "return", "type": "return", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "vector": [13, 2, 0.3578, 0.0015, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join(['%s=%s' % (k, v) for k, v in key_values])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4", "label": "get_normalized_http_method", "type": "function", "loc": [236, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3624, 0.0046, 1, 0.04, 0.5185, 554, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_method", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_method(self):\n \"\"\"Uppercases the http method.\"\"\"\n return self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L237_C8", "label": "expression", "type": "expression", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4", "vector": [8, 2, 0.3624, 0.0015, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Uppercases the http method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L238_C8", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4", "vector": [13, 2, 0.3639, 0.0015, 2, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "label": "get_normalized_http_url", "type": "function", "loc": [240, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3739, 0.0153, 1, 0.04, 0.5556, 60, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_url(self):\n \"\"\"Parses the URL and rebuilds it to be scheme://host/path.\"\"\"\n parts = urlparse.urlparse(self.http_url)\n scheme, netloc, path = parts[:3]\n # Exclude default port numbers.\n if scheme == 'http' and netloc[-3:] == ':80':\n netloc = netloc[:-3]\n elif scheme == 'https' and netloc[-4:] == ':443':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L241_C8", "label": "expression", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "vector": [8, 2, 0.3685, 0.0015, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses the URL and rebuilds it to be scheme://host/path.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L242_C8", "label": "parts = urlparse()", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "vector": [14, 2, 0.37, 0.0015, 2, 0.08, 0.25, 13, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parts = urlparse.urlparse(self.http_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L243_C8", "label": "scheme, netloc, path =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "vector": [14, 2, 0.3716, 0.0015, 2, 0.08, 0.5, 388, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scheme, netloc, path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme, netloc, path = parts[:3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8", "label": "if", "type": "if", "loc": [245, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "vector": [4, 2, 0.3769, 0.0061, 2, 0.08, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if scheme == 'http' and netloc[-3:] == ':80':\n netloc = netloc[:-3]\n elif scheme == 'https' and netloc[-4:] == ':443':\n netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L246_C12", "label": "netloc =", "type": "assigned_variable", "loc": [246, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8", "vector": [14, 3, 0.3761, 0.0015, 3, 0.5, 0.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "netloc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " netloc = netloc[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L247_C8", "label": "if", "type": "if", "loc": [247, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8", "vector": [4, 3, 0.3784, 0.0031, 3, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif scheme == 'https' and netloc[-4:] == ':443':\n netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L248_C12", "label": "netloc =", "type": "assigned_variable", "loc": [248, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L247_C8", "vector": [14, 4, 0.3792, 0.0015, 4, 0.9, 0.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "netloc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " netloc = netloc[:-4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L249_C8", "label": "return", "type": "return", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "vector": [13, 2, 0.3807, 0.0015, 2, 0.08, 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' % (scheme, netloc, path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "label": "sign_request", "type": "function", "loc": [251, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3884, 0.0107, 1, 0.04, 0.5926, 817, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "sign_request", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sign_request(self, signature_method, consumer, token):\n \"\"\"Set the signature parameter to the result of build_signature.\"\"\"\n # Set the signature method.\n self.set_parameter('oauth_signature_method',\n signature_method.get_name())\n # Set the signature.\n self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L252_C8", "label": "expression", "type": "expression", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "vector": [8, 2, 0.3853, 0.0015, 2, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Set the signature parameter to the result of build_signature.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L254_C8", "label": "set_parameter()", "type": "expression", "loc": [254, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "vector": [8, 2, 0.3891, 0.0031, 2, 0.8, 0.5, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature_method',\n signature_method.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L257_C8", "label": "set_parameter()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "vector": [8, 2, 0.393, 0.0015, 2, 0.8, 1.0, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature',self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4", "label": "build_signature", "type": "function", "loc": [259, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.3976, 0.0046, 1, 0.04, 0.6296, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, signature_method, consumer, token):\n \"\"\"Calls the build signature method within the signature method.\"\"\"\n return signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L260_C8", "label": "expression", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4", "vector": [8, 2, 0.3976, 0.0015, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls the build signature method within the signature method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L261_C8", "label": "return", "type": "return", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4", "vector": [13, 2, 0.3991, 0.0015, 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 signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "label": "from_request", "type": "function", "loc": [263, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.4274, 0.052, 1, 0.04, 0.6667, 713, 0, 5, 1, 0, 0, 0, 9], "semantic": {"name": "from_request", "arg_names": ["http_method", "http_url", "headers", "parameters", "query_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_request(http_method, http_url, headers=None, parameters=None,\n query_string=None):\n \"\"\"Combines multiple parameter sources.\"\"\"\n if parameters is None:\n parameters = {}\n\n # Headers\n if headers and 'Authorization' in headers:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L265_C8", "label": "expression", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [8, 2, 0.4052, 0.0015, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Combines multiple parameter sources.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L266_C8", "label": "if", "type": "if", "loc": [266, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [4, 2, 0.4075, 0.0031, 2, 0.61, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters is None:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L267_C12", "label": "parameters =", "type": "assigned_variable", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L266_C8", "vector": [14, 3, 0.4083, 0.0015, 3, 0.37, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8", "label": "if", "type": "if", "loc": [270, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [4, 2, 0.4213, 0.0183, 2, 0.61, 0.25, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if headers and 'Authorization' in headers:\n auth_header = headers['Authorization']\n # Check that the authorization header is OAuth.\n if auth_header[:6] == 'OAuth ':\n auth_header = auth_header[6:]\n try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L271_C12", "label": "auth_header =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8", "vector": [14, 3, 0.4144, 0.0015, 3, 0.3, 0.0, 774, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = headers['Authorization']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12", "label": "if", "type": "if", "loc": [273, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8", "vector": [4, 3, 0.4235, 0.0138, 3, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_header[:6] == 'OAuth ':\n auth_header = auth_header[6:]\n try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L274_C16", "label": "auth_header =", "type": "assigned_variable", "loc": [274, 274], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12", "vector": [14, 4, 0.419, 0.0015, 4, 0.84, 0.0, 774, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = auth_header[6:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16", "label": "try", "type": "try", "loc": [275, 281], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12", "vector": [7, 4, 0.4251, 0.0107, 4, 0.84, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the parameters from the header.\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from '\n 'Authorization header.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L277_C20", "label": "header_params = _split_header()", "type": "assigned_variable", "loc": [277, 277], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16", "vector": [14, 5, 0.4235, 0.0015, 5, 0.99, 0.0, 121, 3, 1, 0, 0, 848, 10, 1], "semantic": {"name": "header_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_header", "annotation": ""}, "snippet": " header_params = OAuthRequest._split_header(auth_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L278_C20", "label": "update()", "type": "expression", "loc": [278, 278], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16", "vector": [8, 5, 0.4251, 0.0015, 5, 0.99, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(header_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8", "label": "if", "type": "if", "loc": [284, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [4, 2, 0.4358, 0.0046, 2, 0.61, 0.375, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if query_string:\n query_params = OAuthRequest._split_url_string(query_string)\n parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L285_C12", "label": "query_params = _split_url_string()", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8", "vector": [14, 3, 0.4358, 0.0015, 3, 0.82, 0.0, 950, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "query_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " query_params = OAuthRequest._split_url_string(query_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L286_C12", "label": "update()", "type": "expression", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8", "vector": [8, 3, 0.4373, 0.0015, 3, 0.82, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L289_C8", "label": "param_str =", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [14, 2, 0.4419, 0.0015, 2, 0.61, 0.5, 886, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "param_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " param_str = urlparse.urlparse(http_url)[4] # query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L290_C8", "label": "url_params = _split_url_string()", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [14, 2, 0.4434, 0.0015, 2, 0.61, 0.625, 664, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "url_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " url_params = OAuthRequest._split_url_string(param_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L291_C8", "label": "update()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [8, 2, 0.445, 0.0015, 2, 0.61, 0.75, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(url_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L293_C8", "label": "if", "type": "if", "loc": [293, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [4, 2, 0.4488, 0.0031, 2, 0.61, 0.875, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters:\n return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L294_C12", "label": "return", "type": "return", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L293_C8", "vector": [13, 3, 0.4495, 0.0015, 3, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "vector": [13, 2, 0.4526, 0.0015, 2, 0.61, 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_122:Assign_L297_C4", "label": "from_request = staticmethod()", "type": "assigned_variable", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.4541, 0.0015, 1, 0.04, 0.7037, 713, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_request", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_request = staticmethod(from_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "label": "from_consumer_and_token", "type": "function", "loc": [299, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.4778, 0.0428, 1, 0.04, 0.7407, 319, 0, 7, 1, 0, 0, 0, 4], "semantic": {"name": "from_consumer_and_token", "arg_names": ["oauth_consumer", "token", "callback", "verifier", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_consumer_and_token(oauth_consumer, token=None,\n callback=None, verifier=None, http_method=HTTP_METHOD,\n http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n defaults = {\n 'oauth_consumer_key': oauth_consumer.key,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L302_C8", "label": "if", "type": "if", "loc": [302, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [4, 2, 0.4625, 0.0031, 2, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L303_C12", "label": "parameters =", "type": "assigned_variable", "loc": [303, 303], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L302_C8", "vector": [14, 3, 0.4633, 0.0015, 3, 0.08, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L305_C8", "label": "defaults =", "type": "assigned_variable", "loc": [305, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [14, 2, 0.4702, 0.0092, 2, 0.49, 0.2, 233, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "defaults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " defaults = {\n 'oauth_consumer_key': oauth_consumer.key,\n 'oauth_timestamp': generate_timestamp(),\n 'oauth_nonce': generate_nonce(),\n 'oauth_version': OAuthRequest.version,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L312_C8", "label": "update()", "type": "expression", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [8, 2, 0.4771, 0.0015, 2, 0.49, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " defaults.update(parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L313_C8", "label": "parameters =", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [14, 2, 0.4786, 0.0015, 2, 0.49, 0.6, 29, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = defaults"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "label": "if", "type": "if", "loc": [315, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [4, 2, 0.4885, 0.0153, 2, 0.49, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n parameters['oauth_token'] = token.key\n if token.callback:\n parameters['oauth_callback'] = token.callback\n # 1.0a support for verifier.\n if verifier:\n parameters['oauth_verifier'] = verifier\n elif callback:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L316_C12", "label": "assign", "type": "assigned_variable", "loc": [316, 316], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "vector": [14, 3, 0.4832, 0.0015, 3, 0.48, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L317_C12", "label": "if", "type": "if", "loc": [317, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "vector": [4, 3, 0.4855, 0.0031, 3, 0.48, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token.callback:\n parameters['oauth_callback'] = token.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L318_C16", "label": "assign", "type": "assigned_variable", "loc": [318, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L317_C12", "vector": [14, 4, 0.4862, 0.0015, 4, 0.47, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = token.callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L320_C12", "label": "if", "type": "if", "loc": [320, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "vector": [4, 3, 0.4901, 0.0031, 3, 0.48, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if verifier:\n parameters['oauth_verifier'] = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L321_C16", "label": "assign", "type": "assigned_variable", "loc": [321, 321], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L320_C12", "vector": [14, 4, 0.4908, 0.0015, 4, 0.04, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_verifier'] = verifier"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L322_C8", "label": "if", "type": "if", "loc": [322, 324], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "vector": [4, 3, 0.4939, 0.0046, 3, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callback:\n # 1.0a support for callback in the request token request.\n parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L324_C12", "label": "assign", "type": "assigned_variable", "loc": [324, 324], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L322_C8", "vector": [14, 4, 0.4954, 0.0015, 4, 0.28, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L326_C8", "label": "return", "type": "return", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "vector": [13, 2, 0.4985, 0.0015, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L327_C4", "label": "from_consumer_and_token = staticmethod()", "type": "assigned_variable", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.5, 0.0015, 1, 0.04, 0.7778, 319, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_consumer_and_token", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_consumer_and_token = staticmethod(from_consumer_and_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "label": "from_token_and_callback", "type": "function", "loc": [329, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.5107, 0.0168, 1, 0.04, 0.8148, 823, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "from_token_and_callback", "arg_names": ["token", "callback", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD,\n http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n parameters['oauth_token'] = token.key\n\n if callback:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L331_C8", "label": "if", "type": "if", "loc": [331, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "vector": [4, 2, 0.5069, 0.0031, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L332_C12", "label": "parameters =", "type": "assigned_variable", "loc": [332, 332], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L331_C8", "vector": [14, 3, 0.5076, 0.0015, 3, 0.38, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L334_C8", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "vector": [14, 2, 0.5107, 0.0015, 2, 0.26, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L336_C8", "label": "if", "type": "if", "loc": [336, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "vector": [4, 2, 0.5145, 0.0031, 2, 0.26, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callback:\n parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L337_C12", "label": "assign", "type": "assigned_variable", "loc": [337, 337], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L336_C8", "vector": [14, 3, 0.5153, 0.0015, 3, 0.39, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_callback'] = callback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L339_C8", "label": "return", "type": "return", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "vector": [13, 2, 0.5183, 0.0015, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L340_C4", "label": "from_token_and_callback = staticmethod()", "type": "assigned_variable", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.5199, 0.0015, 1, 0.04, 0.8519, 823, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "from_token_and_callback", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " from_token_and_callback = staticmethod(from_token_and_callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "label": "_split_header", "type": "function", "loc": [342, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.5336, 0.0229, 1, 0.04, 0.8889, 848, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_split_header", "arg_names": ["header"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_header(header):\n \"\"\"Turn Authorization: header into parameters.\"\"\"\n params = {}\n parts = header.split(',')\n for param in parts:\n # Ignore realm parameter.\n if param.find('realm') > -1:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L343_C8", "label": "expression", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "vector": [8, 2, 0.5245, 0.0015, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Turn Authorization: header into parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L344_C8", "label": "params =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "vector": [14, 2, 0.526, 0.0015, 2, 0.35, 0.25, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L345_C8", "label": "parts = split()", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "vector": [14, 2, 0.5275, 0.0015, 2, 0.35, 0.5, 13, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " parts = header.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "label": "for param", "type": "for", "loc": [346, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "vector": [6, 2, 0.5359, 0.0153, 2, 0.35, 0.75, 841, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param in parts:\n # Ignore realm parameter.\n if param.find('realm') > -1:\n continue\n # Remove whitespace.\n param = param.strip()\n # Split key-value.\n param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L348_C12", "label": "if", "type": "if", "loc": [348, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "vector": [4, 3, 0.5329, 0.0031, 3, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if param.find('realm') > -1:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L351_C12", "label": "param = strip()", "type": "assigned_variable", "loc": [351, 351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "vector": [14, 3, 0.5367, 0.0015, 3, 0.03, 0.3333, 841, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " param = param.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L353_C12", "label": "param_parts = split()", "type": "assigned_variable", "loc": [353, 353], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "vector": [14, 3, 0.5398, 0.0015, 3, 0.03, 0.6667, 328, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "param_parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L355_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [355, 355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "vector": [14, 3, 0.5428, 0.0015, 3, 0.03, 1.0, 0, 3, 1, 0, 0, 432, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\\\"'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L356_C8", "label": "return", "type": "return", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "vector": [13, 2, 0.5443, 0.0015, 2, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L357_C4", "label": "_split_header = staticmethod()", "type": "assigned_variable", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.5459, 0.0015, 1, 0.04, 0.9259, 848, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "_split_header", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " _split_header = staticmethod(_split_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "label": "_split_url_string", "type": "function", "loc": [359, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [2, 1, 0.5528, 0.0092, 1, 0.04, 0.963, 90, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_split_url_string", "arg_names": ["param_str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_url_string(param_str):\n \"\"\"Turn URL string into parameters.\"\"\"\n parameters = cgi.parse_qs(param_str, keep_blank_values=False)\n for k, v in parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L360_C8", "label": "expression", "type": "expression", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "vector": [8, 2, 0.5505, 0.0015, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Turn URL string into parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L361_C8", "label": "parameters = parse_qs()", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "vector": [14, 2, 0.552, 0.0015, 2, 0.3, 0.3333, 29, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " parameters = cgi.parse_qs(param_str, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:For_L362_C8", "label": "for k, v", "type": "for", "loc": [362, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "vector": [6, 2, 0.5543, 0.0031, 2, 0.3, 0.6667, 867, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L363_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [363, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:For_L362_C8", "vector": [14, 3, 0.555, 0.0015, 3, 0.7, 0.0, 0, 3, 1, 0, 0, 432, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L364_C8", "label": "return", "type": "return", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "vector": [13, 2, 0.5566, 0.0015, 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 parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L365_C4", "label": "_split_url_string = staticmethod()", "type": "assigned_variable", "loc": [365, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "vector": [14, 1, 0.5581, 0.0015, 1, 0.04, 1.0, 90, 3, 1, 0, 0, 884, 10, 1], "semantic": {"name": "_split_url_string", "arg_names": [], "import_names": [], "rhs_call_name": "staticmethod", "annotation": ""}, "snippet": " _split_url_string = staticmethod(_split_url_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "label": "OAuthServer", "type": "class", "loc": [367, 525], "level": 0, "parent": null, "vector": [3, 0, 0.682, 0.2431, 0, 0.66, 0.8077, 779, 0, 18, 0, 0, 186, 0, 52], "semantic": {"name": "OAuthServer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthServer(object):\n \"\"\"A worker to check the validity of a request against a data store.\"\"\"\n timestamp_threshold = 300 # In seconds, five minutes.\n version = VERSION\n signature_methods = None\n data_store = None\n\n def __init__(self, data_store=None, signature_methods=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L368_C4", "label": "expression", "type": "expression", "loc": [368, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [8, 1, 0.5627, 0.0015, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A worker to check the validity of a request against a data store.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L369_C4", "label": "timestamp_threshold =", "type": "assigned_variable", "loc": [369, 369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [14, 1, 0.5642, 0.0015, 1, 0.84, 0.0455, 129, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "timestamp_threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timestamp_threshold = 300 # In seconds, five minutes."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L370_C4", "label": "version =", "type": "assigned_variable", "loc": [370, 370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [14, 1, 0.5657, 0.0015, 1, 0.84, 0.0909, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L371_C4", "label": "signature_methods =", "type": "assigned_variable", "loc": [371, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [14, 1, 0.5673, 0.0015, 1, 0.84, 0.1364, 544, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_methods = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L372_C4", "label": "data_store =", "type": "assigned_variable", "loc": [372, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [14, 1, 0.5688, 0.0015, 1, 0.84, 0.1818, 82, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_store = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4", "label": "__init__", "type": "function", "loc": [374, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.5734, 0.0046, 1, 0.84, 0.2273, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "data_store", "signature_methods"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, data_store=None, signature_methods=None):\n self.data_store = data_store\n self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L375_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4", "vector": [14, 2, 0.5734, 0.0015, 2, 0.27, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L376_C8", "label": "self.signature_methods =", "type": "assigned_variable", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4", "vector": [14, 2, 0.5749, 0.0015, 2, 0.27, 1.0, 94, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L378_C4", "label": "set_data_store", "type": "function", "loc": [378, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.5787, 0.0031, 1, 0.84, 0.2727, 928, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_data_store", "arg_names": ["self", "data_store"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_data_store(self, data_store):\n self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L379_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L378_C4", "vector": [14, 2, 0.5795, 0.0015, 2, 0.84, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L381_C4", "label": "get_data_store", "type": "function", "loc": [381, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.5833, 0.0031, 1, 0.84, 0.3182, 473, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_data_store", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data_store(self):\n return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L382_C8", "label": "return", "type": "return", "loc": [382, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L381_C4", "vector": [13, 2, 0.5841, 0.0015, 2, 0.3, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4", "label": "add_signature_method", "type": "function", "loc": [384, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.5887, 0.0046, 1, 0.84, 0.3636, 134, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add_signature_method", "arg_names": ["self", "signature_method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_signature_method(self, signature_method):\n self.signature_methods[signature_method.get_name()] = signature_method\n return self.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L385_C8", "label": "assign", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4", "vector": [14, 2, 0.5887, 0.0015, 2, 0.3, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods[signature_method.get_name()] = signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L386_C8", "label": "return", "type": "return", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4", "vector": [13, 2, 0.5902, 0.0015, 2, 0.3, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "label": "fetch_request_token", "type": "function", "loc": [388, 406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.607, 0.0291, 1, 0.84, 0.4091, 255, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n \"\"\"Processes a request_token request and returns the\n request token on success.\n \"\"\"\n try:\n # Get the request token for authorization.\n token = self._get_token(oauth_request, 'request')\n except OAuthError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L389_C8", "label": "expression", "type": "expression", "loc": [389, 391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "vector": [8, 2, 0.5963, 0.0046, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Processes a request_token request and returns the\n request token on success.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "label": "try", "type": "try", "loc": [392, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "vector": [7, 2, 0.6093, 0.0214, 2, 0.29, 0.5, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the request token for authorization.\n token = self._get_token(oauth_request, 'request')\n except OAuthError:\n # No token required for the initial token request.\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L394_C12", "label": "token = _get_token()", "type": "assigned_variable", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [14, 3, 0.6024, 0.0015, 3, 0.68, 0.0, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L397_C12", "label": "version = _get_version()", "type": "assigned_variable", "loc": [397, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [14, 3, 0.607, 0.0015, 3, 0.68, 0.0, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L398_C12", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [14, 3, 0.6086, 0.0015, 3, 0.68, 0.25, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12", "label": "try", "type": "try", "loc": [399, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [7, 3, 0.6124, 0.0061, 3, 0.68, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n callback = self.get_callback(oauth_request)\n except OAuthError:\n callback = None # 1.0, no callback specified."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L400_C16", "label": "callback = get_callback()", "type": "assigned_variable", "loc": [400, 400], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12", "vector": [14, 4, 0.6116, 0.0015, 4, 0.98, 0.0, 342, 3, 1, 0, 0, 564, 10, 1], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "get_callback", "annotation": ""}, "snippet": " callback = self.get_callback(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L402_C16", "label": "callback =", "type": "assigned_variable", "loc": [402, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12", "vector": [14, 4, 0.6147, 0.0015, 4, 0.98, 0.0, 342, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "callback", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " callback = None # 1.0, no callback specified."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L403_C12", "label": "_check_signature()", "type": "expression", "loc": [403, 403], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [8, 3, 0.6162, 0.0015, 3, 0.68, 0.75, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L405_C12", "label": "token = fetch_request_token()", "type": "assigned_variable", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "vector": [14, 3, 0.6193, 0.0015, 3, 0.68, 1.0, 129, 3, 2, 0, 0, 255, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_request_token", "annotation": ""}, "snippet": " token = self.data_store.fetch_request_token(consumer, callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L406_C8", "label": "return", "type": "return", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "vector": [13, 2, 0.6208, 0.0015, 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 token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "label": "fetch_access_token", "type": "function", "loc": [408, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6346, 0.0229, 1, 0.84, 0.4545, 413, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n \"\"\"Processes an access_token request and returns the\n access token on success.\n \"\"\"\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n try:\n verifier = self._get_verifier(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L409_C8", "label": "expression", "type": "expression", "loc": [409, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [8, 2, 0.6269, 0.0046, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Processes an access_token request and returns the\n access token on success.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L412_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [14, 2, 0.63, 0.0015, 2, 0.53, 0.1429, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L413_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [14, 2, 0.6315, 0.0015, 2, 0.53, 0.2857, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8", "label": "try", "type": "try", "loc": [414, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [7, 2, 0.6353, 0.0061, 2, 0.53, 0.4286, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n verifier = self._get_verifier(oauth_request)\n except OAuthError:\n verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L415_C12", "label": "verifier = _get_verifier()", "type": "assigned_variable", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8", "vector": [14, 3, 0.6346, 0.0015, 3, 0.92, 0.0, 629, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "_get_verifier", "annotation": ""}, "snippet": " verifier = self._get_verifier(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L417_C12", "label": "verifier =", "type": "assigned_variable", "loc": [417, 417], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8", "vector": [14, 3, 0.6376, 0.0015, 3, 0.92, 0.0, 629, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "verifier", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verifier = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L419_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [14, 2, 0.6407, 0.0015, 2, 0.53, 0.5714, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L420_C8", "label": "_check_signature()", "type": "expression", "loc": [420, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [8, 2, 0.6422, 0.0015, 2, 0.53, 0.7143, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L421_C8", "label": "new_token = fetch_access_token()", "type": "assigned_variable", "loc": [421, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [14, 2, 0.6437, 0.0015, 2, 0.53, 0.8571, 945, 3, 3, 0, 0, 413, 10, 1], "semantic": {"name": "new_token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_access_token", "annotation": ""}, "snippet": " new_token = self.data_store.fetch_access_token(consumer, token, verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L422_C8", "label": "return", "type": "return", "loc": [422, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "vector": [13, 2, 0.6453, 0.0015, 2, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "label": "verify_request", "type": "function", "loc": [424, 433], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6552, 0.0153, 1, 0.84, 0.5, 168, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "verify_request", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_request(self, oauth_request):\n \"\"\"Verifies an api call and checks all the parameters.\"\"\"\n # -> consumer and token\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n # Get the access token.\n token = self._get_token(oauth_request, 'access')\n self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L425_C8", "label": "expression", "type": "expression", "loc": [425, 425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [8, 2, 0.6498, 0.0015, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verifies an api call and checks all the parameters.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L427_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [427, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [14, 2, 0.6529, 0.0015, 2, 0.72, 0.1667, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L428_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [14, 2, 0.6544, 0.0015, 2, 0.72, 0.3333, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L430_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [430, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [14, 2, 0.6575, 0.0015, 2, 0.72, 0.5, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'access')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L431_C8", "label": "_check_signature()", "type": "expression", "loc": [431, 431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [8, 2, 0.659, 0.0015, 2, 0.72, 0.6667, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L432_C8", "label": "parameters = get_nonoauth_parameters()", "type": "assigned_variable", "loc": [432, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [14, 2, 0.6606, 0.0015, 2, 0.72, 0.8333, 29, 3, 0, 0, 0, 748, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "get_nonoauth_parameters", "annotation": ""}, "snippet": " parameters = oauth_request.get_nonoauth_parameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L433_C8", "label": "return", "type": "return", "loc": [433, 433], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "vector": [13, 2, 0.6621, 0.0015, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return consumer, token, parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4", "label": "authorize_token", "type": "function", "loc": [435, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6667, 0.0046, 1, 0.84, 0.5455, 36, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "authorize_token", "arg_names": ["self", "token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_token(self, token, user):\n \"\"\"Authorize a request token.\"\"\"\n return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L436_C8", "label": "expression", "type": "expression", "loc": [436, 436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4", "vector": [8, 2, 0.6667, 0.0015, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Authorize a request token.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L437_C8", "label": "return", "type": "return", "loc": [437, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4", "vector": [13, 2, 0.6682, 0.0015, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4", "label": "get_callback", "type": "function", "loc": [439, 441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6728, 0.0046, 1, 0.84, 0.5909, 564, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_callback", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_callback(self, oauth_request):\n \"\"\"Get the callback URL.\"\"\"\n return oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L440_C8", "label": "expression", "type": "expression", "loc": [440, 440], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4", "vector": [8, 2, 0.6728, 0.0015, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get the callback URL.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L441_C8", "label": "return", "type": "return", "loc": [441, 441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4", "vector": [13, 2, 0.6743, 0.0015, 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 oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4", "label": "build_authenticate_header", "type": "function", "loc": [443, 445], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6789, 0.0046, 1, 0.84, 0.6364, 279, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_authenticate_header(self, realm=''):\n \"\"\"Optional support for the authenticate header.\"\"\"\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L444_C8", "label": "expression", "type": "expression", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4", "vector": [8, 2, 0.6789, 0.0015, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Optional support for the authenticate header.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L445_C8", "label": "return", "type": "return", "loc": [445, 445], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4", "vector": [13, 2, 0.6804, 0.0015, 2, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "label": "_get_version", "type": "function", "loc": [447, 455], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.6896, 0.0138, 1, 0.84, 0.6818, 602, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_version", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_version(self, oauth_request):\n \"\"\"Verify the correct version request for this server.\"\"\"\n try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION\n if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L448_C8", "label": "expression", "type": "expression", "loc": [448, 448], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "vector": [8, 2, 0.685, 0.0015, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify the correct version request for this server.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8", "label": "try", "type": "try", "loc": [449, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "vector": [7, 2, 0.6888, 0.0061, 2, 0.28, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L450_C12", "label": "version = get_parameter()", "type": "assigned_variable", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8", "vector": [14, 3, 0.6881, 0.0015, 3, 0.0, 0.0, 623, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " version = oauth_request.get_parameter('oauth_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L452_C12", "label": "version =", "type": "assigned_variable", "loc": [452, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8", "vector": [14, 3, 0.6911, 0.0015, 3, 0.0, 0.0, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L453_C8", "label": "if", "type": "if", "loc": [453, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "vector": [4, 2, 0.6934, 0.0031, 2, 0.28, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L455_C8", "label": "return", "type": "return", "loc": [455, 455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "vector": [13, 2, 0.6957, 0.0015, 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 version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "label": "_get_signature_method", "type": "function", "loc": [457, 472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7102, 0.0245, 1, 0.84, 0.7273, 261, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_signature_method", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_signature_method(self, oauth_request):\n \"\"\"Figure out the signature with some defaults.\"\"\"\n try:\n signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L458_C8", "label": "expression", "type": "expression", "loc": [458, 458], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "vector": [8, 2, 0.7003, 0.0015, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Figure out the signature with some defaults.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8", "label": "try", "type": "try", "loc": [459, 463], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "vector": [7, 2, 0.7049, 0.0076, 2, 0.48, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L460_C12", "label": "signature_method = get_parameter()", "type": "assigned_variable", "loc": [460, 461], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8", "vector": [14, 3, 0.7041, 0.0031, 3, 0.15, 0.0, 352, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature_method = oauth_request.get_parameter(\n 'oauth_signature_method')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L463_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [463, 463], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8", "vector": [14, 3, 0.708, 0.0015, 3, 0.15, 0.0, 352, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8", "label": "try", "type": "try", "loc": [464, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "vector": [7, 2, 0.7141, 0.0107, 2, 0.48, 0.6667, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Get the signature method object.\n signature_method = self.signature_methods[signature_method]\n except:\n signature_method_names = ', '.join(self.signature_methods.keys())\n raise OAuthError('Signature method %s not supported try one of the '\n 'following: %s' % (signature_method, signature_method_names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L466_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8", "vector": [14, 3, 0.7125, 0.0015, 3, 0.94, 0.0, 352, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = self.signature_methods[signature_method]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L468_C12", "label": "signature_method_names = join()", "type": "assigned_variable", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8", "vector": [14, 3, 0.7156, 0.0015, 3, 0.94, 0.0, 896, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "signature_method_names", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " signature_method_names = ', '.join(self.signature_methods.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L472_C8", "label": "return", "type": "return", "loc": [472, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "vector": [13, 2, 0.7217, 0.0015, 2, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "label": "_get_consumer", "type": "function", "loc": [474, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7286, 0.0092, 1, 0.84, 0.7727, 561, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_consumer", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_consumer(self, oauth_request):\n consumer_key = oauth_request.get_parameter('oauth_consumer_key')\n consumer = self.data_store.lookup_consumer(consumer_key)\n if not consumer:\n raise OAuthError('Invalid consumer.')\n return consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L475_C8", "label": "consumer_key = get_parameter()", "type": "assigned_variable", "loc": [475, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "vector": [14, 2, 0.7263, 0.0015, 2, 0.09, 0.0, 353, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " consumer_key = oauth_request.get_parameter('oauth_consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L476_C8", "label": "consumer = lookup_consumer()", "type": "assigned_variable", "loc": [476, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "vector": [14, 2, 0.7278, 0.0015, 2, 0.09, 0.3333, 352, 3, 1, 0, 0, 718, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_consumer", "annotation": ""}, "snippet": " consumer = self.data_store.lookup_consumer(consumer_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L477_C8", "label": "if", "type": "if", "loc": [477, 478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "vector": [4, 2, 0.7301, 0.0031, 2, 0.09, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer:\n raise OAuthError('Invalid consumer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L479_C8", "label": "return", "type": "return", "loc": [479, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "vector": [13, 2, 0.7324, 0.0015, 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 consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "label": "_get_token", "type": "function", "loc": [481, 487], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7401, 0.0107, 1, 0.84, 0.8182, 917, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_get_token", "arg_names": ["self", "oauth_request", "token_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_token(self, oauth_request, token_type='access'):\n \"\"\"Try to find the token for the provided request token key.\"\"\"\n token_field = oauth_request.get_parameter('oauth_token')\n token = self.data_store.lookup_token(token_type, token_field)\n if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))\n return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L482_C8", "label": "expression", "type": "expression", "loc": [482, 482], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "vector": [8, 2, 0.737, 0.0015, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to find the token for the provided request token key.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L483_C8", "label": "token_field = get_parameter()", "type": "assigned_variable", "loc": [483, 483], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "vector": [14, 2, 0.7385, 0.0015, 2, 0.73, 0.25, 531, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "token_field", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " token_field = oauth_request.get_parameter('oauth_token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L484_C8", "label": "token = lookup_token()", "type": "assigned_variable", "loc": [484, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "vector": [14, 2, 0.7401, 0.0015, 2, 0.73, 0.5, 129, 3, 2, 0, 0, 87, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_token", "annotation": ""}, "snippet": " token = self.data_store.lookup_token(token_type, token_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L485_C8", "label": "if", "type": "if", "loc": [485, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "vector": [4, 2, 0.7424, 0.0031, 2, 0.73, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L487_C8", "label": "return", "type": "return", "loc": [487, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "vector": [13, 2, 0.7446, 0.0015, 2, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L489_C4", "label": "_get_verifier", "type": "function", "loc": [489, 490], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7485, 0.0031, 1, 0.84, 0.8636, 956, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_verifier", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_verifier(self, oauth_request):\n return oauth_request.get_parameter('oauth_verifier')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L490_C8", "label": "return", "type": "return", "loc": [490, 490], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L489_C4", "vector": [13, 2, 0.7492, 0.0015, 2, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return oauth_request.get_parameter('oauth_verifier')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "label": "_check_signature", "type": "function", "loc": [492, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7653, 0.0275, 1, 0.84, 0.9091, 740, 0, 4, 0, 0, 0, 0, 10], "semantic": {"name": "_check_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_signature(self, oauth_request, consumer, token):\n timestamp, nonce = oauth_request._get_timestamp_nonce()\n self._check_timestamp(timestamp)\n self._check_nonce(consumer, token, nonce)\n signature_method = self._get_signature_method(oauth_request)\n try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L493_C8", "label": "timestamp, nonce = _get_timestamp_nonce()", "type": "assigned_variable", "loc": [493, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [14, 2, 0.7538, 0.0015, 2, 0.76, 0.0, 88, 3, 0, 0, 0, 211, 10, 1], "semantic": {"name": "timestamp, nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_get_timestamp_nonce", "annotation": ""}, "snippet": " timestamp, nonce = oauth_request._get_timestamp_nonce()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L494_C8", "label": "_check_timestamp()", "type": "expression", "loc": [494, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [8, 2, 0.7554, 0.0015, 2, 0.76, 0.1429, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "_check_timestamp", "annotation": ""}, "snippet": " self._check_timestamp(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L495_C8", "label": "_check_nonce()", "type": "expression", "loc": [495, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [8, 2, 0.7569, 0.0015, 2, 0.76, 0.2857, 731, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_check_nonce", "annotation": ""}, "snippet": " self._check_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L496_C8", "label": "signature_method = _get_signature_method()", "type": "assigned_variable", "loc": [496, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [14, 2, 0.7584, 0.0015, 2, 0.76, 0.4286, 352, 3, 1, 0, 0, 261, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "_get_signature_method", "annotation": ""}, "snippet": " signature_method = self._get_signature_method(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L497_C8", "label": "try", "type": "try", "loc": [497, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [7, 2, 0.7622, 0.0061, 2, 0.76, 0.5714, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:\n raise OAuthError('Missing signature.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L498_C12", "label": "signature = get_parameter()", "type": "assigned_variable", "loc": [498, 498], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L497_C8", "vector": [14, 3, 0.7615, 0.0015, 3, 0.54, 0.0, 932, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature = oauth_request.get_parameter('oauth_signature')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L502_C8", "label": "valid_sig = check_signature()", "type": "assigned_variable", "loc": [502, 503], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [14, 2, 0.7683, 0.0031, 2, 0.76, 0.7143, 108, 3, 4, 0, 0, 862, 10, 1], "semantic": {"name": "valid_sig", "arg_names": [], "import_names": [], "rhs_call_name": "check_signature", "annotation": ""}, "snippet": " valid_sig = signature_method.check_signature(oauth_request, consumer,\n token, signature)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L504_C8", "label": "if", "type": "if", "loc": [504, 508], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [4, 2, 0.7737, 0.0076, 2, 0.76, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not valid_sig:\n key, base = signature_method.build_signature_base_string(\n oauth_request, consumer, token)\n raise OAuthError('Invalid signature. Expected signature base '\n 'string: %s' % base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L505_C12", "label": "key, base = build_signature_base_string()", "type": "assigned_variable", "loc": [505, 506], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L504_C8", "vector": [14, 3, 0.7729, 0.0031, 3, 0.05, 0.0, 994, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, base", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, base = signature_method.build_signature_base_string(\n oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L509_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [509, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "vector": [14, 2, 0.7783, 0.0015, 2, 0.76, 1.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = signature_method.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "label": "_check_timestamp", "type": "function", "loc": [511, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7875, 0.0138, 1, 0.84, 0.9545, 607, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "_check_timestamp", "arg_names": ["self", "timestamp"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_timestamp(self, timestamp):\n \"\"\"Verify that timestamp is recentish.\"\"\"\n timestamp = int(timestamp)\n now = int(time.time())\n lapsed = abs(now - timestamp)\n if lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a '\n 'greater difference than threshold %d' %"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L512_C8", "label": "expression", "type": "expression", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "vector": [8, 2, 0.7829, 0.0015, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify that timestamp is recentish.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L513_C8", "label": "timestamp = int()", "type": "assigned_variable", "loc": [513, 513], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "vector": [14, 2, 0.7844, 0.0015, 2, 0.32, 0.25, 834, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " timestamp = int(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L514_C8", "label": "now = int()", "type": "assigned_variable", "loc": [514, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "vector": [14, 2, 0.7859, 0.0015, 2, 0.32, 0.5, 894, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " now = int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L515_C8", "label": "lapsed = abs()", "type": "assigned_variable", "loc": [515, 515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "vector": [14, 2, 0.7875, 0.0015, 2, 0.32, 0.75, 793, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "lapsed", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " lapsed = abs(now - timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L516_C8", "label": "if", "type": "if", "loc": [516, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "vector": [4, 2, 0.7913, 0.0061, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a '\n 'greater difference than threshold %d' %\n (timestamp, now, self.timestamp_threshold))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "label": "_check_nonce", "type": "function", "loc": [521, 525], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "vector": [2, 1, 0.7997, 0.0076, 1, 0.84, 1.0, 731, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "_check_nonce", "arg_names": ["self", "consumer", "token", "nonce"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_nonce(self, consumer, token, nonce):\n \"\"\"Verify that the nonce is uniqueish.\"\"\"\n nonce = self.data_store.lookup_nonce(consumer, token, nonce)\n if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L522_C8", "label": "expression", "type": "expression", "loc": [522, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "vector": [8, 2, 0.7982, 0.0015, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Verify that the nonce is uniqueish.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L523_C8", "label": "nonce = lookup_nonce()", "type": "assigned_variable", "loc": [523, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "vector": [14, 2, 0.7997, 0.0015, 2, 0.34, 0.5, 116, 3, 3, 0, 0, 379, 10, 1], "semantic": {"name": "nonce", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_nonce", "annotation": ""}, "snippet": " nonce = self.data_store.lookup_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L524_C8", "label": "if", "type": "if", "loc": [524, 525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "vector": [4, 2, 0.802, 0.0031, 2, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "label": "OAuthClient", "type": "class", "loc": [528, 553], "level": 0, "parent": null, "vector": [3, 0, 0.8265, 0.0398, 0, 0.66, 0.8462, 840, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthClient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthClient(object):\n \"\"\"OAuthClient is a worker to attempt to execute a request.\"\"\"\n consumer = None\n token = None\n\n def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L529_C4", "label": "expression", "type": "expression", "loc": [529, 529], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [8, 1, 0.8089, 0.0015, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"OAuthClient is a worker to attempt to execute a request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L530_C4", "label": "consumer =", "type": "assigned_variable", "loc": [530, 530], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [14, 1, 0.8104, 0.0015, 1, 0.43, 0.125, 352, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L531_C4", "label": "token =", "type": "assigned_variable", "loc": [531, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [14, 1, 0.8119, 0.0015, 1, 0.43, 0.25, 129, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4", "label": "__init__", "type": "function", "loc": [533, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.8165, 0.0046, 1, 0.43, 0.375, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L534_C8", "label": "self.consumer =", "type": "assigned_variable", "loc": [534, 534], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4", "vector": [14, 2, 0.8165, 0.0015, 2, 0.88, 0.0, 33, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.consumer = oauth_consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L535_C8", "label": "self.token =", "type": "assigned_variable", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4", "vector": [14, 2, 0.818, 0.0015, 2, 0.88, 1.0, 150, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L537_C4", "label": "get_consumer", "type": "function", "loc": [537, 538], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.8219, 0.0031, 1, 0.43, 0.5, 408, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_consumer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_consumer(self):\n return self.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L538_C8", "label": "return", "type": "return", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L537_C4", "vector": [13, 2, 0.8226, 0.0015, 2, 0.44, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L540_C4", "label": "get_token", "type": "function", "loc": [540, 541], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.8265, 0.0031, 1, 0.43, 0.625, 224, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_token", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_token(self):\n return self.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L541_C8", "label": "return", "type": "return", "loc": [541, 541], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L540_C4", "vector": [13, 2, 0.8272, 0.0015, 2, 0.17, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L543_C4", "label": "fetch_request_token", "type": "function", "loc": [543, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.8318, 0.0046, 1, 0.43, 0.75, 255, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L544_C8", "label": "expression", "type": "expression", "loc": [544, 544], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L543_C4", "vector": [8, 2, 0.8318, 0.0015, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L547_C4", "label": "fetch_access_token", "type": "function", "loc": [547, 549], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.8379, 0.0046, 1, 0.43, 0.875, 413, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L548_C8", "label": "expression", "type": "expression", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L547_C4", "vector": [8, 2, 0.8379, 0.0015, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L551_C4", "label": "access_resource", "type": "function", "loc": [551, 553], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "vector": [2, 1, 0.844, 0.0046, 1, 0.43, 1.0, 654, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "access_resource", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def access_resource(self, oauth_request):\n \"\"\"-> Some protected resource.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L552_C8", "label": "expression", "type": "expression", "loc": [552, 552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L551_C4", "vector": [8, 2, 0.844, 0.0015, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> Some protected resource.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "label": "OAuthDataStore", "type": "class", "loc": [556, 581], "level": 0, "parent": null, "vector": [3, 0, 0.8693, 0.0398, 0, 0.66, 0.8846, 257, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthDataStore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthDataStore(object):\n \"\"\"A database abstraction used to lookup consumers and tokens.\"\"\"\n\n def lookup_consumer(self, key):\n \"\"\"-> OAuthConsumer.\"\"\"\n raise NotImplementedError\n\n def lookup_token(self, oauth_consumer, token_type, token_token):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L557_C4", "label": "expression", "type": "expression", "loc": [557, 557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [8, 1, 0.8517, 0.0015, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A database abstraction used to lookup consumers and tokens.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L559_C4", "label": "lookup_consumer", "type": "function", "loc": [559, 561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8563, 0.0046, 1, 0.85, 0.1667, 718, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_consumer", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_consumer(self, key):\n \"\"\"-> OAuthConsumer.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L560_C8", "label": "expression", "type": "expression", "loc": [560, 560], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L559_C4", "vector": [8, 2, 0.8563, 0.0015, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthConsumer.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L563_C4", "label": "lookup_token", "type": "function", "loc": [563, 565], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8624, 0.0046, 1, 0.85, 0.3333, 87, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_token", "arg_names": ["self", "oauth_consumer", "token_type", "token_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_token(self, oauth_consumer, token_type, token_token):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L564_C8", "label": "expression", "type": "expression", "loc": [564, 564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L563_C4", "vector": [8, 2, 0.8624, 0.0015, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L567_C4", "label": "lookup_nonce", "type": "function", "loc": [567, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8685, 0.0046, 1, 0.85, 0.5, 379, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_nonce", "arg_names": ["self", "oauth_consumer", "oauth_token", "nonce"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_nonce(self, oauth_consumer, oauth_token, nonce):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L568_C8", "label": "expression", "type": "expression", "loc": [568, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L567_C4", "vector": [8, 2, 0.8685, 0.0015, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L571_C4", "label": "fetch_request_token", "type": "function", "loc": [571, 573], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8746, 0.0046, 1, 0.85, 0.6667, 255, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_consumer", "oauth_callback"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_consumer, oauth_callback):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L572_C8", "label": "expression", "type": "expression", "loc": [572, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L571_C4", "vector": [8, 2, 0.8746, 0.0015, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L575_C4", "label": "fetch_access_token", "type": "function", "loc": [575, 577], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8807, 0.0046, 1, 0.85, 0.8333, 413, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_consumer", "oauth_token", "oauth_verifier"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_consumer, oauth_token, oauth_verifier):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L576_C8", "label": "expression", "type": "expression", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L575_C4", "vector": [8, 2, 0.8807, 0.0015, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L579_C4", "label": "authorize_request_token", "type": "function", "loc": [579, 581], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "vector": [2, 1, 0.8869, 0.0046, 1, 0.85, 1.0, 879, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "authorize_request_token", "arg_names": ["self", "oauth_token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_request_token(self, oauth_token, user):\n \"\"\"-> OAuthToken.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L580_C8", "label": "expression", "type": "expression", "loc": [580, 580], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L579_C4", "vector": [8, 2, 0.8869, 0.0015, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> OAuthToken.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "label": "OAuthSignatureMethod", "type": "class", "loc": [584, 600], "level": 0, "parent": null, "vector": [3, 0, 0.9052, 0.026, 0, 0.66, 0.9231, 310, 0, 4, 0, 0, 186, 0, 1], "semantic": {"name": "OAuthSignatureMethod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod(object):\n \"\"\"A strategy class that implements a signature method.\"\"\"\n def get_name(self):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError\n\n def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str key, str raw.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L585_C4", "label": "expression", "type": "expression", "loc": [585, 585], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "vector": [8, 1, 0.8945, 0.0015, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A strategy class that implements a signature method.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L586_C4", "label": "get_name", "type": "function", "loc": [586, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "vector": [2, 1, 0.8976, 0.0046, 1, 0.92, 0.25, 770, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L587_C8", "label": "expression", "type": "expression", "loc": [587, 587], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L586_C4", "vector": [8, 2, 0.8976, 0.0015, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L590_C4", "label": "build_signature_base_string", "type": "function", "loc": [590, 592], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "vector": [2, 1, 0.9037, 0.0046, 1, 0.92, 0.5, 910, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str key, str raw.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L591_C8", "label": "expression", "type": "expression", "loc": [591, 591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L590_C4", "vector": [8, 2, 0.9037, 0.0015, 2, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str key, str raw.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L594_C4", "label": "build_signature", "type": "function", "loc": [594, 596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "vector": [2, 1, 0.9098, 0.0046, 1, 0.92, 0.75, 181, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, oauth_consumer, oauth_token):\n \"\"\"-> str.\"\"\"\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L595_C8", "label": "expression", "type": "expression", "loc": [595, 595], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L594_C4", "vector": [8, 2, 0.9098, 0.0015, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"-> str.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4", "label": "check_signature", "type": "function", "loc": [598, 600], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "vector": [2, 1, 0.9159, 0.0046, 1, 0.92, 1.0, 862, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "check_signature", "arg_names": ["self", "oauth_request", "consumer", "token", "signature"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_signature(self, oauth_request, consumer, token, signature):\n built = self.build_signature(oauth_request, consumer, token)\n return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L599_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [599, 599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4", "vector": [14, 2, 0.9159, 0.0015, 2, 0.78, 0.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = self.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L600_C8", "label": "return", "type": "return", "loc": [600, 600], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4", "vector": [13, 2, 0.9174, 0.0015, 2, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "label": "OAuthSignatureMethod_HMAC_SHA1", "type": "class", "loc": [603, 636], "level": 0, "parent": null, "vector": [3, 0, 0.9472, 0.052, 0, 0.66, 0.9615, 605, 0, 3, 0, 0, 310, 0, 14], "semantic": {"name": "OAuthSignatureMethod_HMAC_SHA1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod):\n\n def get_name(self):\n return 'HMAC-SHA1'\n \n def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L605_C4", "label": "get_name", "type": "function", "loc": [605, 606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "vector": [2, 1, 0.9258, 0.0031, 1, 0.56, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L606_C8", "label": "return", "type": "return", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L605_C4", "vector": [13, 2, 0.9266, 0.0015, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "label": "build_signature_base_string", "type": "function", "loc": [608, 620], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "vector": [2, 1, 0.9388, 0.0199, 1, 0.56, 0.5, 910, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )\n\n key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L609_C8", "label": "sig =", "type": "assigned_variable", "loc": [609, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "vector": [14, 2, 0.9343, 0.0076, 2, 0.15, 0.0, 899, 0, 0, 0, 0, 0, 8, 6], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L615_C8", "label": "key =", "type": "assigned_variable", "loc": [615, 615], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "vector": [14, 2, 0.9404, 0.0015, 2, 0.15, 0.25, 230, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L616_C8", "label": "if", "type": "if", "loc": [616, 617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "vector": [4, 2, 0.9427, 0.0031, 2, 0.15, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n key += escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L619_C8", "label": "raw = join()", "type": "assigned_variable", "loc": [619, 619], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "vector": [14, 2, 0.9465, 0.0015, 2, 0.15, 0.75, 23, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "raw", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " raw = '&'.join(sig)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L620_C8", "label": "return", "type": "return", "loc": [620, 620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "vector": [13, 2, 0.948, 0.0015, 2, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key, raw"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "label": "build_signature", "type": "function", "loc": [622, 636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "vector": [2, 1, 0.9618, 0.0229, 1, 0.56, 1.0, 181, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n \"\"\"Builds the base signature string.\"\"\"\n key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)\n\n # HMAC object.\n try:\n import hashlib # 2.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L623_C8", "label": "expression", "type": "expression", "loc": [623, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "vector": [8, 2, 0.9526, 0.0015, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Builds the base signature string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L624_C8", "label": "key, raw = build_signature_base_string()", "type": "assigned_variable", "loc": [624, 625], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "vector": [14, 2, 0.9549, 0.0031, 2, 0.62, 0.3333, 864, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, raw", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "label": "try", "type": "try", "loc": [628, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "vector": [7, 2, 0.9641, 0.0092, 2, 0.62, 0.6667, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import hashlib # 2.5\n hashed = hmac.new(key, raw, hashlib.sha1)\n except:\n import sha # Deprecated\n hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L629_C12", "label": "hashlib import hashlib", "type": "import", "loc": [629, 629], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "vector": [1, 3, 0.9618, 0.0015, 3, 0.03, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hashlib # 2.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L630_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [630, 630], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "vector": [14, 3, 0.9633, 0.0015, 3, 0.03, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, hashlib.sha1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L632_C12", "label": "sha import sha", "type": "import", "loc": [632, 632], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "vector": [1, 3, 0.9664, 0.0015, 3, 0.03, 0.0, 263, 0, 1, 0, 0, 263, 0, 0], "semantic": {"name": "sha", "arg_names": [], "import_names": ["sha"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sha # Deprecated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L633_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [633, 633], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "vector": [14, 3, 0.9679, 0.0015, 3, 0.03, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L636_C8", "label": "return", "type": "return", "loc": [636, 636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "vector": [13, 2, 0.9725, 0.0015, 2, 0.62, 1.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return binascii.b2a_base64(hashed.digest())[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "label": "OAuthSignatureMethod_PLAINTEXT", "type": "class", "loc": [639, 654], "level": 0, "parent": null, "vector": [3, 0, 0.9885, 0.0245, 0, 0.66, 1.0, 935, 0, 3, 0, 0, 310, 0, 3], "semantic": {"name": "OAuthSignatureMethod_PLAINTEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod):\n\n def get_name(self):\n return 'PLAINTEXT'\n\n def build_signature_base_string(self, oauth_request, consumer, token):\n \"\"\"Concatenates the consumer key and secret.\"\"\"\n sig = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L641_C4", "label": "get_name", "type": "function", "loc": [641, 642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "vector": [2, 1, 0.9809, 0.0031, 1, 0.28, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L642_C8", "label": "return", "type": "return", "loc": [642, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L641_C4", "vector": [13, 2, 0.9817, 0.0015, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "label": "build_signature_base_string", "type": "function", "loc": [644, 649], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "vector": [2, 1, 0.9885, 0.0092, 1, 0.28, 0.5, 910, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n \"\"\"Concatenates the consumer key and secret.\"\"\"\n sig = '%s&' % escape(consumer.secret)\n if token:\n sig = sig + escape(token.secret)\n return sig, sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L645_C8", "label": "expression", "type": "expression", "loc": [645, 645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "vector": [8, 2, 0.9862, 0.0015, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Concatenates the consumer key and secret.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L646_C8", "label": "sig =", "type": "assigned_variable", "loc": [646, 646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "vector": [14, 2, 0.9878, 0.0015, 2, 0.07, 0.3333, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:If_L647_C8", "label": "if", "type": "if", "loc": [647, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "vector": [4, 2, 0.9901, 0.0031, 2, 0.07, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L648_C12", "label": "sig =", "type": "assigned_variable", "loc": [648, 648], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:If_L647_C8", "vector": [14, 3, 0.9908, 0.0015, 3, 0.97, 0.0, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L649_C8", "label": "return", "type": "return", "loc": [649, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "vector": [13, 2, 0.9924, 0.0015, 2, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sig, sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4", "label": "build_signature", "type": "function", "loc": [651, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "vector": [2, 1, 0.9977, 0.0061, 1, 0.28, 1.0, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)\n return key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L652_C8", "label": "key, raw = build_signature_base_string()", "type": "assigned_variable", "loc": [652, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4", "vector": [14, 2, 0.9977, 0.0031, 2, 0.34, 0.0, 864, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, raw", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, raw = self.build_signature_base_string(oauth_request, consumer,\n token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L654_C8", "label": "return", "type": "return", "loc": [654, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4", "vector": [13, 2, 1.0, 0.0015, 2, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:For_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L195_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L197_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L198_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:For_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L206_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L207_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L216_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L246_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L245_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L251_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L274_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L277_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L278_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L316_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L318_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L320_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L321_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L315_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L324_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L331_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L337_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L348_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L353_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L346_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L342_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:For_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:For_L362_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L400_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L402_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L392_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L388_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L408_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L435_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L437_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L439_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L449_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L452_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L447_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L460_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L459_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L463_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L466_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L457_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L479_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L482_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L484_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L496_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L497_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L498_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L502_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L504_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L504_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L505_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L509_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L515_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L511_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L367_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L522_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L521_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L524_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L530_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L534_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L533_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L540_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L540_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L544_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L547_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L528_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L551_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L557_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L559_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L559_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L563_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L567_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L571_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L575_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L575_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L556_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L579_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L585_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L590_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L594_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L594_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L595_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L599_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L600_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L609_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L615_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L616_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L620_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L603_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L629_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L630_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Import_L632_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:Try_L628_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L633_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L641_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Expr_L645_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:If_L647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:If_L647_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L648_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L644_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L649_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:ClassDef_L639_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Assign_L652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_122:FunctionDef_L651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_122:Return_L654_C8"}]
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. """ weibo API library """ __version__ = '1.5' __author__ = 'Joshua Roesslein' __license__ = 'MIT' from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel from weibopy.error import WeibopError from weibopy.api import API from weibopy.cache import Cache, MemoryCache, FileCache from weibopy.auth import BasicAuthHandler, OAuthHandler from weibopy.streaming import Stream, StreamListener from weibopy.cursor import Cursor # Global, unauthenticated instance of API api = API() def debug(enable=True, level=1): import httplib httplib.HTTPConnection.debuglevel = level
ajibawa-2023/Python-Code-Large/train/row_126
15
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_126:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 7], "level": 0, "parent": null, "vector": [8, 0, 0.2222, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nweibo API library\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L8_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2963, 0.037, 0, 0.66, 0.0833, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '1.5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L9_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.037, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Joshua Roesslein'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L10_C0", "label": "__license__ =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3704, 0.037, 0, 0.66, 0.25, 11, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__license__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__license__ = 'MIT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L12_C0", "label": "from weibopy.models import Status, User, DirectMessage\u2026", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.4444, 0.037, 0, 0.66, 0.3333, 659, 0, 8, 0, 0, 659, 0, 0], "semantic": {"name": "weibopy.models", "arg_names": [], "import_names": ["Status", "User", "DirectMessage", "Friendship", "SavedSearch", "SearchResult", "ModelFactory", "IDSModel"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResult, ModelFactory, IDSModel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L13_C0", "label": "from weibopy.error import WeibopError", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.4815, 0.037, 0, 0.66, 0.4167, 972, 0, 1, 0, 0, 972, 0, 0], "semantic": {"name": "weibopy.error", "arg_names": [], "import_names": ["WeibopError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.error import WeibopError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L14_C0", "label": "from weibopy.api import API", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.5185, 0.037, 0, 0.66, 0.5, 947, 0, 1, 0, 0, 947, 0, 0], "semantic": {"name": "weibopy.api", "arg_names": [], "import_names": ["API"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.api import API"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L15_C0", "label": "from weibopy.cache import Cache, MemoryCache, FileCache", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.5556, 0.037, 0, 0.66, 0.5833, 656, 0, 3, 0, 0, 656, 0, 0], "semantic": {"name": "weibopy.cache", "arg_names": [], "import_names": ["Cache", "MemoryCache", "FileCache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.cache import Cache, MemoryCache, FileCache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L16_C0", "label": "from weibopy.auth import BasicAuthHandler, OAuthHandler", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.5926, 0.037, 0, 0.66, 0.6667, 550, 0, 2, 0, 0, 550, 0, 0], "semantic": {"name": "weibopy.auth", "arg_names": [], "import_names": ["BasicAuthHandler", "OAuthHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.auth import BasicAuthHandler, OAuthHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L17_C0", "label": "from weibopy.streaming import Stream, StreamListener", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.6296, 0.037, 0, 0.66, 0.75, 523, 0, 2, 0, 0, 523, 0, 0], "semantic": {"name": "weibopy.streaming", "arg_names": [], "import_names": ["Stream", "StreamListener"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.streaming import Stream, StreamListener"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:ImportFrom_L18_C0", "label": "from weibopy.cursor import Cursor", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.037, 0, 0.66, 0.8333, 482, 0, 1, 0, 0, 482, 0, 0], "semantic": {"name": "weibopy.cursor", "arg_names": [], "import_names": ["Cursor"], "rhs_call_name": "", "annotation": ""}, "snippet": "from weibopy.cursor import Cursor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L21_C0", "label": "api = API()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.7778, 0.037, 0, 0.66, 0.9167, 976, 3, 0, 0, 0, 839, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "API", "annotation": ""}, "snippet": "api = API()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:FunctionDef_L23_C0", "label": "debug", "type": "function", "loc": [23, 26], "level": 0, "parent": null, "vector": [2, 0, 0.9074, 0.1481, 0, 0.66, 1.0, 924, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "debug", "arg_names": ["enable", "level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def debug(enable=True, level=1):\n\n import httplib\n httplib.HTTPConnection.debuglevel = level"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Import_L25_C4", "label": "httplib import httplib", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_126:FunctionDef_L23_C0", "vector": [1, 1, 0.9259, 0.037, 1, 0.0, 0.0, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L26_C4", "label": "httplib.HTTPConnection.debuglevel =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_126:FunctionDef_L23_C0", "vector": [14, 1, 0.963, 0.037, 1, 0.0, 1.0, 92, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "httplib.HTTPConnection.debuglevel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " httplib.HTTPConnection.debuglevel = level"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_126:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_126:Import_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_126:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_126:Assign_L26_C4"}]