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"}] |
"\nif not session.cart:\n # instantiate new cart\n session.cart, session.balance = [], 0\nsess(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_4 | 95 | 148 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_4:If_L2_C0\", \"label\": \"if\", \"type\": \"i(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_4:If_L2_C0\", \"t\": \"ajibawa-2023/Python-Code(...TRUNCATED) |
"###########################################################\n### make sure administrator is on loca(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_5 | 140 | 180 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_5:Import_L5_C0\", \"label\": \"os import os\",(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_5:If_L9_C0\", \"t\": \"ajibawa-2023/Python-Code(...TRUNCATED) |
"#!/usr/bin/python2.4\n#\n# Copyright 2007 The Python-Twitter Developers\n#\n# Licensed under the Ap(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_6 | 19 | 73 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_6:Expr_L17_C0\", \"label\": \"expression\", \"(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_6:FunctionDef_L52_C0\", \"t\": \"ajibawa-2023/P(...TRUNCATED) |
"#!/usr/bin/python2.4\n#\n# Copyright 2007 The Python-Twitter Developers\n#\n# Licensed under the Ap(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_7 | 53 | 91 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_7:Import_L18_C0\", \"label\": \"os import os\"(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_7:Try_L22_C0\", \"t\": \"ajibawa-2023/Python-Co(...TRUNCATED) |
"\"\"\"Implementation of JSONEncoder\n\"\"\"\nimport re\n\ntry:\n from simplejson._speedups impor(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_8 | 230 | 434 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_8:Expr_L1_C0\", \"label\": \"expression\", \"t(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_8:Try_L5_C0\", \"t\": \"ajibawa-2023/Python-Cod(...TRUNCATED) |
"r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-(...TRUNCATED) | ajibawa-2023/Python-Code-Large/train/row_10 | 41 | 316 | 15 | "[\"cat_id\", \"level\", \"center\", \"span\", \"parent_depth\", \"parent_weight\", \"sibling_index\(...TRUNCATED) | "[{\"id\": \"ajibawa-2023/Python-Code-Large/train/row_10:Expr_L1_C0\", \"label\": \"expression\", \"(...TRUNCATED) | "[{\"f\": \"ajibawa-2023/Python-Code-Large/train/row_10:FunctionDef_L120_C0\", \"t\": \"ajibawa-2023(...TRUNCATED) |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 86