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 |
|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore')
## store sessions and tickets there
session.connect(request, response, db=db)
## or store session in Memcache, Redis, etc.
## from gluon.contrib.memdb import MEMDB
## from google.appengine.api.memcache import Client
## session.connect(request, response, db = MEMDB(Client()))
## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'
#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'you@gmail.com'
mail.settings.login = 'username:password'
## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth, filename='private/janrain.key')
#########################################################################
## Define your tables below (or better in another model file) for example
##
## >>> db.define_table('mytable',Field('myfield','string'))
##
## Fields can be 'string','text','password','integer','double','boolean'
## 'date','time','datetime','blob','upload', 'reference TABLENAME'
## There is an implicit 'id integer autoincrement' field
## Consult manual for more options, validators, etc.
##
## More API examples for controllers:
##
## >>> db.mytable.insert(myfield='value')
## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
## >>> for row in rows: print row.id, row.myfield
#########################################################################
## after defining tables, uncomment below to enable auditing
# auth.enable_record_versioning(db)
| ajibawa-2023/Python-Code-Large/train/row_742 | 18 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "label": "if", "type": "if", "loc": [12, 19], "level": 0, "parent": null, "vector": [4, 0, 0.1867, 0.0964, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not request.env.web2py_runtime_gae:\n ## if NOT running on Google App Engine use SQLite or other DB\n db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])\nelse:\n ## connect to Google BigTable (optional 'google:datastore://namespace')\n db = DAL('google:datastore')\n ## store sessions and tickets there\n session.connect(request, response, db=db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L14_C4", "label": "db = DAL()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "vector": [14, 1, 0.1687, 0.012, 1, 0.44, 0.0, 761, 3, 3, 0, 0, 18, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "DAL", "annotation": ""}, "snippet": " db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L17_C4", "label": "db = DAL()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "vector": [14, 1, 0.2048, 0.012, 1, 0.44, 0.5, 761, 3, 1, 0, 0, 18, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "DAL", "annotation": ""}, "snippet": " db = DAL('google:datastore')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Expr_L19_C4", "label": "connect()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "vector": [8, 1, 0.2289, 0.012, 1, 0.44, 1.0, 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=db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L27_C0", "label": "response.generic_patterns =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.3253, 0.012, 0, 0.66, 0.0714, 34, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.generic_patterns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "response.generic_patterns = ['*'] if request.is_local else []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:ImportFrom_L42_C0", "label": "from gluon.tools import Auth, Crud, Service\u2026", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.506, 0.012, 0, 0.66, 0.1429, 322, 0, 5, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["Auth", "Crud", "Service", "PluginManager", "prettydate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import Auth, Crud, Service, PluginManager, prettydate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L43_C0", "label": "auth = Auth()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.5181, 0.012, 0, 0.66, 0.2143, 280, 3, 1, 0, 0, 352, 10, 1], "semantic": {"name": "auth", "arg_names": [], "import_names": [], "rhs_call_name": "Auth", "annotation": ""}, "snippet": "auth = Auth(db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L44_C0", "label": "crud, service, plugins =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.5301, 0.012, 0, 0.66, 0.2857, 941, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "crud, service, plugins", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "crud, service, plugins = Crud(db), Service(), PluginManager()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Expr_L47_C0", "label": "define_tables()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.5663, 0.012, 0, 0.66, 0.3571, 640, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "define_tables", "arg_names": [], "import_names": [], "rhs_call_name": "define_tables", "annotation": ""}, "snippet": "auth.define_tables(username=False, signature=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L50_C0", "label": "mail =", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.6024, 0.012, 0, 0.66, 0.4286, 556, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mail", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mail = auth.settings.mailer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L51_C0", "label": "mail.settings.server =", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.6145, 0.012, 0, 0.66, 0.5, 555, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mail.settings.server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mail.settings.server = 'logging' or 'smtp.gmail.com:587'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L52_C0", "label": "mail.settings.sender =", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.6265, 0.012, 0, 0.66, 0.5714, 204, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mail.settings.sender", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mail.settings.sender = 'you@gmail.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L53_C0", "label": "mail.settings.login =", "type": "assigned_variable", "loc": [53, 53], "level": 0, "parent": null, "vector": [14, 0, 0.6386, 0.012, 0, 0.66, 0.6429, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mail.settings.login", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "mail.settings.login = 'username:password'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L56_C0", "label": "auth.settings.registration_requires_verification =", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.6747, 0.012, 0, 0.66, 0.7143, 112, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "auth.settings.registration_requires_verification", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "auth.settings.registration_requires_verification = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L57_C0", "label": "auth.settings.registration_requires_approval =", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.6867, 0.012, 0, 0.66, 0.7857, 874, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "auth.settings.registration_requires_approval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "auth.settings.registration_requires_approval = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L58_C0", "label": "auth.settings.reset_password_requires_verification =", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.6988, 0.012, 0, 0.66, 0.8571, 192, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "auth.settings.reset_password_requires_verification", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "auth.settings.reset_password_requires_verification = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:ImportFrom_L62_C0", "label": "from gluon.contrib.login_methods.rpx_account import use_janrain", "type": "import", "loc": [62, 62], "level": 0, "parent": null, "vector": [1, 0, 0.747, 0.012, 0, 0.66, 0.9286, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "gluon.contrib.login_methods.rpx_account", "arg_names": [], "import_names": ["use_janrain"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.contrib.login_methods.rpx_account import use_janrain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_742:Expr_L63_C0", "label": "use_janrain()", "type": "expression", "loc": [63, 63], "level": 0, "parent": null, "vector": [8, 0, 0.759, 0.012, 0, 0.66, 1.0, 118, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "use_janrain", "arg_names": [], "import_names": [], "rhs_call_name": "use_janrain", "annotation": ""}, "snippet": "use_janrain(auth, filename='private/janrain.key')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_742:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_742:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_742:Expr_L19_C4"}] |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#########################################################################
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
if you need a simple wiki simple replace the two lines below with:
return auth.wiki()
"""
response.flash = T("Welcome to web2py!")
return dict(message=T('Hello World'))
def user():
"""
exposes:
http://..../[app]/default/user/login
http://..../[app]/default/user/logout
http://..../[app]/default/user/register
http://..../[app]/default/user/profile
http://..../[app]/default/user/retrieve_password
http://..../[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())
@cache.action()
def download():
"""
allows downloading of uploaded files
http://..../[app]/default/download/[filename]
"""
return response.download(request, db)
def call():
"""
exposes services. for example:
http://..../[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
return service()
@auth.requires_signature()
def data():
"""
http://..../[app]/default/data/tables
http://..../[app]/default/data/create/[table]
http://..../[app]/default/data/read/[table]/[id]
http://..../[app]/default/data/update/[table]/[id]
http://..../[app]/default/data/delete/[table]/[id]
http://..../[app]/default/data/select/[table]
http://..../[app]/default/data/search/[table]
but URLs must be signed, i.e. linked with
A('table',_href=URL('data/tables',user_signature=True))
or with the signed load operator
LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
"""
return dict(form=crud())
| ajibawa-2023/Python-Code-Large/train/row_744 | 16 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "label": "index", "type": "function", "loc": [13, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2303, 0.1316, 0, 0.66, 0.0, 780, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index():\n \"\"\"\n example action using the internationalization operator T and flash\n rendered by views/default/index.html or views/generic.html\n\n if you need a simple wiki simple replace the two lines below with:\n return auth.wiki()\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "vector": [8, 1, 0.2237, 0.0921, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n example action using the internationalization operator T and flash\n rendered by views/default/index.html or views/generic.html\n\n if you need a simple wiki simple replace the two lines below with:\n return auth.wiki()\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Assign_L21_C4", "label": "response.flash = T()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "vector": [14, 1, 0.2763, 0.0132, 1, 0.74, 0.5, 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(\"Welcome to web2py!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "vector": [13, 1, 0.2895, 0.0132, 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 dict(message=T('Hello World'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L25_C0", "label": "user", "type": "function", "loc": [25, 39], "level": 0, "parent": null, "vector": [2, 0, 0.4211, 0.1974, 0, 0.66, 0.25, 503, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def user():\n \"\"\"\n exposes:\n http://..../[app]/default/user/login\n http://..../[app]/default/user/logout\n http://..../[app]/default/user/register\n http://..../[app]/default/user/profile\n http://..../[app]/default/user/retrieve_password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L26_C4", "label": "expression", "type": "expression", "loc": [26, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L25_C0", "vector": [8, 1, 0.4211, 0.1711, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n exposes:\n http://..../[app]/default/user/login\n http://..../[app]/default/user/logout\n http://..../[app]/default/user/register\n http://..../[app]/default/user/profile\n http://..../[app]/default/user/retrieve_password\n http://..../[app]/default/user/change_password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L25_C0", "vector": [13, 1, 0.5132, 0.0132, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(form=auth())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L43_C0", "label": "download", "type": "function", "loc": [43, 48], "level": 0, "parent": null, "vector": [2, 0, 0.5987, 0.0789, 0, 0.66, 0.5, 0, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "download", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def download():\n \"\"\"\n allows downloading of uploaded files\n http://..../[app]/default/download/[filename]\n \"\"\"\n return response.download(request, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L43_C0", "vector": [8, 1, 0.5987, 0.0526, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n allows downloading of uploaded files\n http://..../[app]/default/download/[filename]\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L43_C0", "vector": [13, 1, 0.6316, 0.0132, 1, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response.download(request, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L51_C0", "label": "call", "type": "function", "loc": [51, 58], "level": 0, "parent": null, "vector": [2, 0, 0.7171, 0.1053, 0, 0.66, 0.75, 832, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def call():\n \"\"\"\n exposes services. for example:\n http://..../[app]/default/call/jsonrpc\n decorate with @services.jsonrpc the functions to expose\n supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv\n \"\"\"\n return service()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L52_C4", "label": "expression", "type": "expression", "loc": [52, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L51_C0", "vector": [8, 1, 0.7171, 0.0789, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n exposes services. for example:\n http://..../[app]/default/call/jsonrpc\n decorate with @services.jsonrpc the functions to expose\n supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L51_C0", "vector": [13, 1, 0.7632, 0.0132, 1, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return service()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L62_C0", "label": "data", "type": "function", "loc": [62, 76], "level": 0, "parent": null, "vector": [2, 0, 0.9079, 0.1974, 0, 0.66, 1.0, 929, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def data():\n \"\"\"\n http://..../[app]/default/data/tables\n http://..../[app]/default/data/create/[table]\n http://..../[app]/default/data/read/[table]/[id]\n http://..../[app]/default/data/update/[table]/[id]\n http://..../[app]/default/data/delete/[table]/[id]\n http://..../[app]/default/data/select/[table]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L63_C4", "label": "expression", "type": "expression", "loc": [63, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L62_C0", "vector": [8, 1, 0.9079, 0.1711, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n http://..../[app]/default/data/tables\n http://..../[app]/default/data/create/[table]\n http://..../[app]/default/data/read/[table]/[id]\n http://..../[app]/default/data/update/[table]/[id]\n http://..../[app]/default/data/delete/[table]/[id]\n http://..../[app]/default/data/select/[table]\n http://..../[app]/default/data/search/[table]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L62_C0", "vector": [13, 1, 1.0, 0.0132, 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 dict(form=crud())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_744:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_744:Return_L76_C4"}] |
# -*- coding: utf-8 -*-
# This is an app-specific example router
#
# This simple router is used for setting languages from app/languages directory
# as a part of the application path: app/<lang>/controller/function
# Language from default.py or 'en' (if the file is not found) is used as
# a default_language
#
# See <web2py-root-dir>/router.example.py for parameter's detail
#-------------------------------------------------------------------------------------
# To enable this route file you must do the steps:
#
# 1. rename <web2py-root-dir>/router.example.py to routes.py
# 2. rename this APP/routes.example.py to APP/routes.py
# (where APP - is your application directory)
# 3. restart web2py (or reload routes in web2py admin interfase)
#
# YOU CAN COPY THIS FILE TO ANY APLLICATION'S ROOT DIRECTORY WITHOUT CHANGES!
from fileutils import abspath
from languages import read_possible_languages
possible_languages = read_possible_languages(abspath('applications', app))
#NOTE! app - is an application based router's parameter with name of an
# application. E.g.'welcome'
routers = {
app: dict(
default_language = possible_languages['default'][0],
languages = [lang for lang in possible_languages
if lang != 'default']
)
}
#NOTE! To change language in your application using these rules add this line
#in one of your models files:
# if request.uri_language: T.force(request.uri_language)
| ajibawa-2023/Python-Code-Large/train/row_745 | 4 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_745:ImportFrom_L21_C0", "label": "from fileutils import abspath", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.5526, 0.0263, 0, 0.66, 0.0, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "fileutils", "arg_names": [], "import_names": ["abspath"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fileutils import abspath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_745:ImportFrom_L22_C0", "label": "from languages import read_possible_languages", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.5789, 0.0263, 0, 0.66, 0.3333, 126, 0, 1, 0, 0, 126, 0, 0], "semantic": {"name": "languages", "arg_names": [], "import_names": ["read_possible_languages"], "rhs_call_name": "", "annotation": ""}, "snippet": "from languages import read_possible_languages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_745:Assign_L24_C0", "label": "possible_languages = read_possible_languages()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.6316, 0.0263, 0, 0.66, 0.6667, 664, 3, 1, 0, 0, 433, 10, 2], "semantic": {"name": "possible_languages", "arg_names": [], "import_names": [], "rhs_call_name": "read_possible_languages", "annotation": ""}, "snippet": "possible_languages = read_possible_languages(abspath('applications', app))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_745:Assign_L28_C0", "label": "routers =", "type": "assigned_variable", "loc": [28, 34], "level": 0, "parent": null, "vector": [14, 0, 0.8158, 0.1842, 0, 0.66, 1.0, 839, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "routers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "routers = {\n app: dict(\n default_language = possible_languages['default'][0],\n languages = [lang for lang in possible_languages\n if lang != 'default']\n )\n}"}] | [] |
#!/usr/bin/env python
from setuptools import setup
from gluon.fileutils import tar, untar, read_file, write_file
import tarfile
import sys
def tar(file, filelist, expression='^.+$'):
"""
tars dir/files into file, only tars file that match expression
"""
tar = tarfile.TarFile(file, 'w')
try:
for element in filelist:
try:
for file in listdir(element, expression, add_dirs=True):
tar.add(os.path.join(element, file), file, False)
except:
tar.add(element)
finally:
tar.close()
def start():
if 'sdist' in sys.argv:
tar('gluon/env.tar', ['applications', 'VERSION', 'splashlogo.gif'])
setup(name='web2py',
version=read_file("VERSION").split()[1],
description="""full-stack framework for rapid development and prototyping
of secure database-driven web-based applications, written and
programmable in Python.""",
long_description="""
Everything in one package with no dependencies. Development, deployment,
debugging, testing, database administration and maintenance of applications can
be done via the provided web interface. web2py has no configuration files,
requires no installation, can run off a USB drive. web2py uses Python for the
Model, the Views and the Controllers, has a built-in ticketing system to manage
errors, an internationalization engine, works with SQLite, PostgreSQL, MySQL,
MSSQL, FireBird, Oracle, IBM DB2, Informix, Ingres, sybase and Google App Engine via a
Database Abstraction Layer. web2py includes libraries to handle
HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. Production
ready, capable of upload/download streaming of very large files, and always
backward compatible.
""",
author='Massimo Di Pierro',
author_email='mdipierro@cs.depaul.edu',
license='http://web2py.com/examples/default/license',
classifiers=["Development Status :: 5 - Production/Stable"],
url='http://web2py.com',
platforms='Windows, Linux, Mac, Unix,Windows Mobile',
packages=['gluon',
'gluon/contrib',
'gluon/contrib/gateways',
'gluon/contrib/login_methods',
'gluon/contrib/markdown',
'gluon/contrib/markmin',
'gluon/contrib/memcache',
'gluon/contrib/fpdf',
'gluon/contrib/pymysql',
'gluon/contrib/pyrtf',
'gluon/contrib/pysimplesoap',
'gluon/contrib/simplejson',
'gluon/tests',
],
package_data={'gluon': ['env.tar']},
scripts=['w2p_apps', 'w2p_run', 'w2p_clone'],
)
if __name__ == '__main__':
#print "web2py does not require installation and"
#print "you should just start it with:"
#print
#print "$ python web2py.py"
#print
#print "are you sure you want to install it anyway (y/n)?"
#s = raw_input('>')
#if s.lower()[:1]=='y':
start()
| ajibawa-2023/Python-Code-Large/train/row_746 | 20 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_746:ImportFrom_L3_C0", "label": "from setuptools import setup", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0123, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from setuptools import setup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:ImportFrom_L4_C0", "label": "from gluon.fileutils import tar, untar, read_file\u2026", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0494, 0.0123, 0, 0.66, 0.1667, 948, 0, 4, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["tar", "untar", "read_file", "write_file"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.fileutils import tar, untar, read_file, write_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Import_L5_C0", "label": "tarfile import tarfile", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0617, 0.0123, 0, 0.66, 0.3333, 223, 0, 1, 0, 0, 223, 0, 0], "semantic": {"name": "tarfile", "arg_names": [], "import_names": ["tarfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tarfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Import_L6_C0", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.0123, 0, 0.66, 0.5, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "label": "tar", "type": "function", "loc": [9, 23], "level": 0, "parent": null, "vector": [2, 0, 0.1975, 0.1852, 0, 0.66, 0.6667, 249, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "tar", "arg_names": ["file", "filelist", "expression"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tar(file, filelist, expression='^.+$'):\n \"\"\"\n tars dir/files into file, only tars file that match expression\n \"\"\"\n\n tar = tarfile.TarFile(file, 'w')\n try:\n for element in filelist:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "vector": [8, 1, 0.1358, 0.037, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n tars dir/files into file, only tars file that match expression\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Assign_L14_C4", "label": "tar = TarFile()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "vector": [14, 1, 0.1728, 0.0123, 1, 0.77, 0.5, 249, 3, 2, 0, 0, 305, 10, 1], "semantic": {"name": "tar", "arg_names": [], "import_names": [], "rhs_call_name": "TarFile", "annotation": ""}, "snippet": " tar = tarfile.TarFile(file, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4", "label": "try", "type": "try", "loc": [15, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "vector": [7, 1, 0.2346, 0.1111, 1, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for element in filelist:\n try:\n for file in listdir(element, expression, add_dirs=True):\n tar.add(os.path.join(element, file), file, False)\n except:\n tar.add(element)\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:For_L16_C8", "label": "for element", "type": "for", "loc": [16, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4", "vector": [6, 2, 0.2284, 0.0741, 2, 0.83, 0.0, 736, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for element in filelist:\n try:\n for file in listdir(element, expression, add_dirs=True):\n tar.add(os.path.join(element, file), file, False)\n except:\n tar.add(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12", "label": "try", "type": "try", "loc": [17, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:For_L16_C8", "vector": [7, 3, 0.2346, 0.0617, 3, 0.45, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for file in listdir(element, expression, add_dirs=True):\n tar.add(os.path.join(element, file), file, False)\n except:\n tar.add(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:For_L18_C16", "label": "for file", "type": "for", "loc": [18, 19], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12", "vector": [6, 4, 0.2284, 0.0247, 4, 0.38, 0.0, 107, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in listdir(element, expression, add_dirs=True):\n tar.add(os.path.join(element, file), file, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L19_C20", "label": "add()", "type": "expression", "loc": [19, 19], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:For_L18_C16", "vector": [8, 5, 0.2346, 0.0123, 5, 0.54, 0.0, 241, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " tar.add(os.path.join(element, file), file, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L21_C16", "label": "add()", "type": "expression", "loc": [21, 21], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12", "vector": [8, 4, 0.2593, 0.0123, 4, 0.38, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " tar.add(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L23_C8", "label": "close()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4", "vector": [8, 2, 0.284, 0.0123, 2, 0.83, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L26_C0", "label": "start", "type": "function", "loc": [26, 70], "level": 0, "parent": null, "vector": [2, 0, 0.5926, 0.5556, 0, 0.66, 0.8333, 511, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def start():\n if 'sdist' in sys.argv:\n tar('gluon/env.tar', ['applications', 'VERSION', 'splashlogo.gif'])\n\n setup(name='web2py',\n version=read_file(\"VERSION\").split()[1],\n description=\"\"\"full-stack framework for rapid development and prototyping\n of secure database-driven web-based applications, written and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:If_L27_C4", "label": "if", "type": "if", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L26_C0", "vector": [4, 1, 0.3395, 0.0247, 1, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'sdist' in sys.argv:\n tar('gluon/env.tar', ['applications', 'VERSION', 'splashlogo.gif'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L28_C8", "label": "tar()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:If_L27_C4", "vector": [8, 2, 0.3457, 0.0123, 2, 0.99, 0.0, 249, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "tar", "arg_names": [], "import_names": [], "rhs_call_name": "tar", "annotation": ""}, "snippet": " tar('gluon/env.tar', ['applications', 'VERSION', 'splashlogo.gif'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L30_C4", "label": "setup()", "type": "expression", "loc": [30, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L26_C0", "vector": [8, 1, 0.6173, 0.5062, 1, 0.09, 1.0, 234, 3, 13, 0, 0, 0, 0, 3], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " setup(name='web2py',\n version=read_file(\"VERSION\").split()[1],\n description=\"\"\"full-stack framework for rapid development and prototyping\n of secure database-driven web-based applications, written and\n programmable in Python.\"\"\",\n long_description=\"\"\"\n Everything in one package with no dependencies. Development, deployment,\n debugging, testing, database administration and maintenance of applications can"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:If_L72_C0", "label": "if", "type": "if", "loc": [72, 81], "level": 0, "parent": null, "vector": [4, 0, 0.9444, 0.1235, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n #print \"web2py does not require installation and\"\n #print \"you should just start it with:\"\n #print\n #print \"$ python web2py.py\"\n #print\n #print \"are you sure you want to install it anyway (y/n)?\"\n #s = raw_input('>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L81_C4", "label": "start()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_746:If_L72_C0", "vector": [8, 1, 1.0, 0.0123, 1, 0.69, 0.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " start()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_746:For_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:For_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_746:For_L18_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:For_L18_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L19_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L21_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_746:If_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_746:Expr_L81_C4"}] |
"""
web2py handler for isapi-wsgi for IIS. Requires:
http://code.google.com/p/isapi-wsgi/
"""
# The entry point for the ISAPI extension.
def __ExtensionFactory__():
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
import gluon.main
import isapi_wsgi
application = gluon.main.wsgibase
return isapi_wsgi.ISAPIThreadPoolHandler(application)
# ISAPI installation:
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
print "USAGE: python isapiwsgihandler.py install --server=Sitename"
sys.exit(0)
from isapi.install import ISAPIParameters
from isapi.install import ScriptMapParams
from isapi.install import VirtualDirParameters
from isapi.install import HandleCommandLine
params = ISAPIParameters()
sm = [ScriptMapParams(Extension="*", Flags=0)]
vd = VirtualDirParameters(Name="appname",
Description="Web2py in Python",
ScriptMaps=sm,
ScriptMapUpdate="replace")
params.VirtualDirs = [vd]
HandleCommandLine(params)
| ajibawa-2023/Python-Code-Large/train/row_747 | 25 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0676, 0.1081, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nweb2py handler for isapi-wsgi for IIS. Requires:\nhttp://code.google.com/p/isapi-wsgi/\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "label": "__ExtensionFactory__", "type": "function", "loc": [8, 17], "level": 0, "parent": null, "vector": [2, 0, 0.3378, 0.2703, 0, 0.66, 0.5, 892, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "__ExtensionFactory__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def __ExtensionFactory__():\n import os\n import sys\n path = os.path.dirname(os.path.abspath(__file__))\n os.chdir(path)\n sys.path = [path] + [p for p in sys.path if not p == path]\n import gluon.main\n import isapi_wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L9_C4", "label": "os import os", "type": "import", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [1, 1, 0.2432, 0.027, 1, 0.87, 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_747:Import_L10_C4", "label": "sys import sys", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [1, 1, 0.2703, 0.027, 1, 0.87, 0.125, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L11_C4", "label": "path = dirname()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [14, 1, 0.2973, 0.027, 1, 0.87, 0.25, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L12_C4", "label": "chdir()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [8, 1, 0.3243, 0.027, 1, 0.87, 0.375, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L13_C4", "label": "sys.path =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [14, 1, 0.3514, 0.027, 1, 0.87, 0.5, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L14_C4", "label": "gluon.main import gluon.main", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [1, 1, 0.3784, 0.027, 1, 0.87, 0.625, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L15_C4", "label": "isapi_wsgi import isapi_wsgi", "type": "import", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [1, 1, 0.4054, 0.027, 1, 0.87, 0.75, 585, 0, 1, 0, 0, 585, 0, 0], "semantic": {"name": "isapi_wsgi", "arg_names": [], "import_names": ["isapi_wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " import isapi_wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L16_C4", "label": "application =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [14, 1, 0.4324, 0.027, 1, 0.87, 0.875, 244, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "vector": [13, 1, 0.4595, 0.027, 1, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return isapi_wsgi.ISAPIThreadPoolHandler(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "label": "if", "type": "if", "loc": [20, 37], "level": 0, "parent": null, "vector": [4, 0, 0.7703, 0.4865, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import sys\n if len(sys.argv) < 2:\n print(\"USAGE: python isapiwsgihandler.py install --server=Sitename\")\n sys.exit(0)\n from isapi.install import ISAPIParameters\n from isapi.install import ScriptMapParams\n from isapi.install import VirtualDirParameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L21_C4", "label": "sys import sys", "type": "import", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [1, 1, 0.5676, 0.027, 1, 0.76, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4", "label": "if", "type": "if", "loc": [22, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [4, 1, 0.6216, 0.0811, 1, 0.76, 0.1, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) < 2:\n print(\"USAGE: python isapiwsgihandler.py install --server=Sitename\")\n sys.exit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L23_C8", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4", "vector": [8, 2, 0.6216, 0.027, 2, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"USAGE: python isapiwsgihandler.py install --server=Sitename\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L24_C8", "label": "exit()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4", "vector": [8, 2, 0.6486, 0.027, 2, 0.73, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L25_C4", "label": "from isapi.install import ISAPIParameters", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [1, 1, 0.6757, 0.027, 1, 0.76, 0.2, 701, 0, 1, 0, 0, 701, 0, 0], "semantic": {"name": "isapi.install", "arg_names": [], "import_names": ["ISAPIParameters"], "rhs_call_name": "", "annotation": ""}, "snippet": " from isapi.install import ISAPIParameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L26_C4", "label": "from isapi.install import ScriptMapParams", "type": "import", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [1, 1, 0.7027, 0.027, 1, 0.76, 0.3, 701, 0, 1, 0, 0, 701, 0, 0], "semantic": {"name": "isapi.install", "arg_names": [], "import_names": ["ScriptMapParams"], "rhs_call_name": "", "annotation": ""}, "snippet": " from isapi.install import ScriptMapParams"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L27_C4", "label": "from isapi.install import VirtualDirParameters", "type": "import", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [1, 1, 0.7297, 0.027, 1, 0.76, 0.4, 701, 0, 1, 0, 0, 701, 0, 0], "semantic": {"name": "isapi.install", "arg_names": [], "import_names": ["VirtualDirParameters"], "rhs_call_name": "", "annotation": ""}, "snippet": " from isapi.install import VirtualDirParameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L28_C4", "label": "from isapi.install import HandleCommandLine", "type": "import", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [1, 1, 0.7568, 0.027, 1, 0.76, 0.5, 701, 0, 1, 0, 0, 701, 0, 0], "semantic": {"name": "isapi.install", "arg_names": [], "import_names": ["HandleCommandLine"], "rhs_call_name": "", "annotation": ""}, "snippet": " from isapi.install import HandleCommandLine"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L30_C4", "label": "params = ISAPIParameters()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [14, 1, 0.8108, 0.027, 1, 0.76, 0.6, 206, 3, 0, 0, 0, 500, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "ISAPIParameters", "annotation": ""}, "snippet": " params = ISAPIParameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L31_C4", "label": "sm =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [14, 1, 0.8378, 0.027, 1, 0.76, 0.7, 21, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sm = [ScriptMapParams(Extension=\"*\", Flags=0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L32_C4", "label": "vd = VirtualDirParameters()", "type": "assigned_variable", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [14, 1, 0.9054, 0.1081, 1, 0.76, 0.8, 817, 3, 4, 0, 0, 199, 10, 1], "semantic": {"name": "vd", "arg_names": [], "import_names": [], "rhs_call_name": "VirtualDirParameters", "annotation": ""}, "snippet": " vd = VirtualDirParameters(Name=\"appname\",\n Description=\"Web2py in Python\",\n ScriptMaps=sm,\n ScriptMapUpdate=\"replace\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L36_C4", "label": "params.VirtualDirs =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [14, 1, 0.973, 0.027, 1, 0.76, 0.9, 568, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "params.VirtualDirs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params.VirtualDirs = [vd]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L37_C4", "label": "HandleCommandLine()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "vector": [8, 1, 1.0, 0.027, 1, 0.76, 1.0, 144, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "HandleCommandLine", "arg_names": [], "import_names": [], "rhs_call_name": "HandleCommandLine", "annotation": ""}, "snippet": " HandleCommandLine(params)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Import_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:ImportFrom_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_747:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_747:Expr_L37_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a CGI handler for Apache
Requires apache+[mod_cgi or mod_cgid].
In httpd.conf put something like:
LoadModule cgi_module modules/mod_cgi.so
ScriptAlias / /path/to/cgihandler.py/
Example of httpd.conf ------------
<VirtualHost *:80>
ServerName web2py.example.com
ScriptAlias / /users/www-data/web2py/cgihandler.py/
<Directory /users/www-data/web2py>
AllowOverride None
Order Allow,Deny
Deny from all
<Files cgihandler.py>
Allow from all
</Files>
</Directory>
AliasMatch ^/([^/]+)/static/(.*) \
/users/www-data/web2py/applications/$1/static/$2
<Directory /users/www-data/web2py/applications/*/static/>
Order Allow,Deny
Allow from all
</Directory>
<Location /admin>
Deny from all
</Location>
<LocationMatch ^/([^/]+)/appadmin>
Deny from all
</LocationMatch>
CustomLog /private/var/log/apache2/access.log common
ErrorLog /private/var/log/apache2/error.log
</VirtualHost>
----------------------------------
"""
import os
import sys
import wsgiref.handlers
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
import gluon.main
wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase)
| ajibawa-2023/Python-Code-Large/train/row_748 | 9 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_748:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 51], "level": 0, "parent": null, "vector": [8, 0, 0.4365, 0.7619, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nThis is a CGI handler for Apache\nRequires apache+[mod_cgi or mod_cgid].\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Import_L53_C0", "label": "os import os", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.8413, 0.0159, 0, 0.66, 0.125, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Import_L54_C0", "label": "sys import sys", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 0.8571, 0.0159, 0, 0.66, 0.25, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Import_L55_C0", "label": "wsgiref.handlers import wsgiref.handlers", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.873, 0.0159, 0, 0.66, 0.375, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "wsgiref.handlers", "arg_names": [], "import_names": ["wsgiref.handlers"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wsgiref.handlers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Assign_L57_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.9048, 0.0159, 0, 0.66, 0.5, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Expr_L58_C0", "label": "chdir()", "type": "expression", "loc": [58, 58], "level": 0, "parent": null, "vector": [8, 0, 0.9206, 0.0159, 0, 0.66, 0.625, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Assign_L59_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [59, 59], "level": 0, "parent": null, "vector": [14, 0, 0.9365, 0.0159, 0, 0.66, 0.75, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Import_L61_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [61, 61], "level": 0, "parent": null, "vector": [1, 0, 0.9683, 0.0159, 0, 0.66, 0.875, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_748:Expr_L63_C0", "label": "run()", "type": "expression", "loc": [63, 63], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0159, 0, 0.66, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": "wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase)"}] | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Sropulpof is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sropulpof. If not, see <http:#www.gnu.org/licenses/>.
"""
This script parse a directory tree looking for python modules and packages and
create ReST files appropriately to create code documentation with Sphinx.
It also create a modules index.
"""
import os
import optparse
# automodule options
options = ['members',
'undoc-members',
# 'inherited-members', # disable because there's a bug in sphinx
'show-inheritance']
def create_file_name(base, opts):
"""Create file name from base name, path and suffix"""
return os.path.join(opts.destdir, "%s.%s" % (base, opts.suffix))
def write_directive(module):
"""Create the automodule directive and add the options"""
directive = '.. automodule:: %s\n' % module
for option in options:
directive += ' :%s:\n' % option
return directive
def write_heading(module, kind='Module'):
"""Create the page heading."""
module = module.title()
heading = title_line(module + ' Documentation', '=')
heading += 'This page contains the %s %s documentation.\n\n' % (module, kind)
return heading
def write_sub(module, kind='Module'):
"""Create the module subtitle"""
sub = title_line('The :mod:`%s` %s' % (module, kind), '-')
return sub
def title_line(title, char):
""" Underline the title with the character pass, with the right length."""
return '%s\n%s\n\n' % (title, len(title) * char)
def create_module_file(root, module, opts):
"""Build the text of the file and write the file."""
name = create_file_name(module, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it
print 'Creating file %s for module.' % name
text = write_heading(module)
text += write_sub(module)
text += write_directive(module)
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def create_package_file(root, subroot, py_files, opts, subs=None):
"""Build the text of the file and write the file."""
package = root.rpartition('/')[2].lower()
name = create_file_name(subroot, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
else:
print 'Creating file %s for package.' % name
text = write_heading(package, 'Package')
if subs == None:
subs = []
else:
# build a list of directories that are package (they contain an __init_.py file)
subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]
# if there's some package directories, add a TOC for theses subpackages
if subs:
text += title_line('Subpackages', '-')
text += '.. toctree::\n\n'
for sub in subs:
text += ' %s.%s\n' % (subroot, sub)
text += '\n'
# add each package's module
for py_file in py_files:
if not check_for_code('%s/%s' % (root, py_file)):
# don't build the file if there's no code in it
continue
py_file = py_file[:-3]
py_path = '%s.%s' % (subroot, py_file)
kind = "Module"
if py_file == '__init__':
kind = "Package"
text += write_sub(kind == 'Package' and package or py_file, kind)
text += write_directive(kind == "Package" and subroot or py_path)
text += '\n'
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def check_for_code(module):
"""
Check if there's at least one class or one function in the module.
"""
fd = open(module, 'r')
for line in fd:
if line.startswith('def ') or line.startswith('class '):
fd.close()
return True
fd.close()
return False
def recurse_tree(path, excludes, opts):
"""
Look for every file in the directory tree and create the corresponding
ReST files.
"""
toc = []
excludes = format_excludes(path, excludes)
tree = os.walk(path, False)
for root, subs, files in tree:
# keep only the Python script files
py_files = check_py_file(files)
# remove hidden ('.') and private ('_') directories
subs = [sub for sub in subs if sub[0] not in ['.', '_']]
# check if there's valid files to process
if "/." in root or "/_" in root \
or not py_files \
or check_excludes(root, excludes):
continue
subroot = root[len(path):].lstrip('/').replace('/', '.')
if root == path:
# we are at the root level so we create only modules
for py_file in py_files:
module = py_file[:-3]
create_module_file(root, module, opts)
toc.append(module)
elif not subs and "__init__.py" in py_files:
# we are in a package without sub package
create_package_file(root, subroot, py_files, opts=opts)
toc.append(subroot)
elif "__init__.py" in py_files:
# we are in package with subpackage(s)
create_package_file(root, subroot, py_files, opts, subs)
toc.append(subroot)
# create the module's index
if not opts.notoc:
modules_toc(toc, opts)
def modules_toc(modules, opts, name='modules'):
"""
Create the module's index.
"""
fname = create_file_name(name, opts)
if not opts.force and os.path.exists(fname):
print "File %s already exists." % name
return
print "Creating module's index modules.txt."
text = write_heading(opts.header, 'Modules')
text += title_line('Modules:', '-')
text += '.. toctree::\n'
text += ' :maxdepth: %s\n\n' % opts.maxdepth
modules.sort()
prev_module = ''
for module in modules:
# look if the module is a subpackage and, if yes, ignore it
if module.startswith(prev_module + '.'):
continue
prev_module = module
text += ' %s\n' % module
# write the file
if not opts.dryrun:
fd = open(fname, 'w')
fd.write(text)
fd.close()
def format_excludes(path, excludes):
"""
Format the excluded directory list.
(verify that the path is not from the root of the volume or the root of the
package)
"""
f_excludes = []
for exclude in excludes:
if exclude[0] != '/' and exclude[:len(path)] != path:
exclude = '%s/%s' % (path, exclude)
# remove trailing slash
f_excludes.append(exclude.rstrip('/'))
return f_excludes
def check_excludes(root, excludes):
"""
Check if the directory is in the exclude list.
"""
for exclude in excludes:
if root[:len(exclude)] == exclude:
return True
return False
def check_py_file(files):
"""
Return a list with only the python scripts (remove all other files).
"""
py_files = [fich for fich in files if fich[-3:] == '.py']
return py_files
if __name__ == '__main__':
parser = optparse.OptionParser(usage="""usage: %prog [options] <package path> [exclude paths, ...]
Note: By default this script will not overwrite already created files.""")
parser.add_option("-n", "--doc-header", action="store", dest="header", help="Documentation Header (default=Project)", default="Project")
parser.add_option("-d", "--dest-dir", action="store", dest="destdir", help="Output destination directory", default="")
parser.add_option("-s", "--suffix", action="store", dest="suffix", help="module suffix (default=txt)", default="txt")
parser.add_option("-m", "--maxdepth", action="store", dest="maxdepth", help="Maximum depth of submodules to show in the TOC (default=4)", type="int", default=4)
parser.add_option("-r", "--dry-run", action="store_true", dest="dryrun", help="Run the script without creating the files")
parser.add_option("-f", "--force", action="store_true", dest="force", help="Overwrite all the files")
parser.add_option("-t", "--no-toc", action="store_true", dest="notoc", help="Don't create the table of content file")
(opts, args) = parser.parse_args()
if len(args) < 1:
parser.error("package path is required.")
else:
if os.path.isdir(args[0]):
# if there's some exclude arguments, build the list of excludes
excludes = args[1:]
recurse_tree(args[0], excludes, opts)
else:
print '%s is not a valid directory.' % args
| ajibawa-2023/Python-Code-Large/train/row_749 | 143 | 258 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.093, 0.0194, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis script parse a directory tree looking for python modules and packages and\ncreate ReST files appropriately to create code documentation with Sphinx.\nIt also create a modules index. \n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Import_L28_C0", "label": "os import os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1085, 0.0039, 0, 0.66, 0.0588, 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_749:Import_L29_C0", "label": "optparse import optparse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1124, 0.0039, 0, 0.66, 0.1176, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L33_C0", "label": "options =", "type": "assigned_variable", "loc": [33, 36], "level": 0, "parent": null, "vector": [14, 0, 0.1337, 0.0155, 0, 0.66, 0.1765, 707, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options = ['members',\n 'undoc-members',\n# 'inherited-members', # disable because there's a bug in sphinx\n 'show-inheritance']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "label": "create_file_name", "type": "function", "loc": [38, 40], "level": 0, "parent": null, "vector": [2, 0, 0.1512, 0.0116, 0, 0.66, 0.2353, 96, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "create_file_name", "arg_names": ["base", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_file_name(base, opts):\n \"\"\"Create file name from base name, path and suffix\"\"\"\n return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "vector": [8, 1, 0.1512, 0.0039, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create file name from base name, path and suffix\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "vector": [13, 1, 0.155, 0.0039, 1, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "label": "write_directive", "type": "function", "loc": [42, 47], "level": 0, "parent": null, "vector": [2, 0, 0.1725, 0.0233, 0, 0.66, 0.2941, 996, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "write_directive", "arg_names": ["module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_directive(module):\n \"\"\"Create the automodule directive and add the options\"\"\"\n directive = '.. automodule:: %s\\n' % module\n for option in options:\n directive += ' :%s:\\n' % option\n return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "vector": [8, 1, 0.1667, 0.0039, 1, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the automodule directive and add the options\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L44_C4", "label": "directive =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "vector": [14, 1, 0.1705, 0.0039, 1, 0.63, 0.3333, 677, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "directive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " directive = '.. automodule:: %s\\n' % module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L45_C4", "label": "for option", "type": "for", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "vector": [6, 1, 0.1764, 0.0078, 1, 0.63, 0.6667, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for option in options:\n directive += ' :%s:\\n' % option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "vector": [13, 1, 0.1822, 0.0039, 1, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "label": "write_heading", "type": "function", "loc": [49, 54], "level": 0, "parent": null, "vector": [2, 0, 0.1996, 0.0233, 0, 0.66, 0.3529, 573, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "write_heading", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_heading(module, kind='Module'):\n \"\"\"Create the page heading.\"\"\"\n module = module.title()\n heading = title_line(module + ' Documentation', '=')\n heading += 'This page contains the %s %s documentation.\\n\\n' % (module, kind)\n return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "vector": [8, 1, 0.1938, 0.0039, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the page heading.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L51_C4", "label": "module = title()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "vector": [14, 1, 0.1977, 0.0039, 1, 0.36, 0.3333, 98, 3, 0, 0, 0, 48, 10, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " module = module.title()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L52_C4", "label": "heading = title_line()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "vector": [14, 1, 0.2016, 0.0039, 1, 0.36, 0.6667, 841, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "heading", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " heading = title_line(module + ' Documentation', '=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L54_C4", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "vector": [13, 1, 0.2093, 0.0039, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "label": "write_sub", "type": "function", "loc": [56, 59], "level": 0, "parent": null, "vector": [2, 0, 0.2229, 0.0155, 0, 0.66, 0.4118, 320, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "write_sub", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_sub(module, kind='Module'):\n \"\"\"Create the module subtitle\"\"\"\n sub = title_line('The :mod:`%s` %s' % (module, kind), '-')\n return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "vector": [8, 1, 0.2209, 0.0039, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the module subtitle\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L58_C4", "label": "sub = title_line()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "vector": [14, 1, 0.2248, 0.0039, 1, 0.56, 0.5, 819, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " sub = title_line('The :mod:`%s` %s' % (module, kind), '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "vector": [13, 1, 0.2287, 0.0039, 1, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L61_C0", "label": "title_line", "type": "function", "loc": [61, 63], "level": 0, "parent": null, "vector": [2, 0, 0.2403, 0.0116, 0, 0.66, 0.4706, 810, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "title_line", "arg_names": ["title", "char"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def title_line(title, char):\n \"\"\" Underline the title with the character pass, with the right length.\"\"\"\n return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L61_C0", "vector": [8, 1, 0.2403, 0.0039, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Underline the title with the character pass, with the right length.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L61_C0", "vector": [13, 1, 0.2442, 0.0039, 1, 0.14, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "label": "create_module_file", "type": "function", "loc": [65, 80], "level": 0, "parent": null, "vector": [2, 0, 0.281, 0.062, 0, 0.66, 0.5294, 545, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "create_module_file", "arg_names": ["root", "module", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_module_file(root, module, opts):\n \"\"\"Build the text of the file and write the file.\"\"\"\n name = create_file_name(module, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L66_C4", "label": "expression", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "vector": [8, 1, 0.2558, 0.0039, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L67_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "vector": [14, 1, 0.2597, 0.0039, 1, 0.41, 0.5, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4", "label": "if", "type": "if", "loc": [68, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "vector": [4, 1, 0.2868, 0.0504, 1, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(module)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L69_C8", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4", "vector": [8, 2, 0.2674, 0.0039, 2, 0.7, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "label": "if", "type": "if", "loc": [70, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4", "vector": [4, 2, 0.2907, 0.0426, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(module)\n\n # write the file\n if not opts.dryrun: "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L71_C8", "label": "print()", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "vector": [8, 3, 0.2752, 0.0039, 3, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for module.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L72_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "vector": [14, 3, 0.2791, 0.0039, 3, 0.53, 0.5, 439, 3, 1, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "label": "if", "type": "if", "loc": [77, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "vector": [4, 3, 0.3043, 0.0155, 3, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L78_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "vector": [14, 4, 0.3023, 0.0039, 4, 0.11, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L79_C12", "label": "write()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "vector": [8, 4, 0.3062, 0.0039, 4, 0.11, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L80_C12", "label": "close()", "type": "expression", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "vector": [8, 4, 0.3101, 0.0039, 4, 0.11, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "label": "create_package_file", "type": "function", "loc": [82, 122], "level": 0, "parent": null, "vector": [2, 0, 0.3953, 0.1589, 0, 0.66, 0.5882, 711, 0, 5, 0, 0, 0, 0, 15], "semantic": {"name": "create_package_file", "arg_names": ["root", "subroot", "py_files", "opts", "subs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_package_file(root, subroot, py_files, opts, subs=None):\n \"\"\"Build the text of the file and write the file.\"\"\"\n package = root.rpartition('/')[2].lower()\n name = create_file_name(subroot, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L83_C4", "label": "expression", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "vector": [8, 1, 0.3217, 0.0039, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L84_C4", "label": "package = lower()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "vector": [14, 1, 0.3256, 0.0039, 1, 0.75, 0.3333, 187, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "package", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " package = root.rpartition('/')[2].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L85_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "vector": [14, 1, 0.3295, 0.0039, 1, 0.75, 0.6667, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(subroot, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "label": "if", "type": "if", "loc": [86, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "vector": [4, 1, 0.4031, 0.1434, 1, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)\n text = write_heading(package, 'Package')\n if subs == None:\n subs = []\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L87_C8", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [8, 2, 0.3372, 0.0039, 2, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L89_C8", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [8, 2, 0.345, 0.0039, 2, 0.97, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L90_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [14, 2, 0.3488, 0.0039, 2, 0.97, 0.4, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(package, 'Package')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "label": "if", "type": "if", "loc": [91, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [4, 2, 0.374, 0.0465, 2, 0.97, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs == None:\n subs = []\n else:\n # build a list of directories that are package (they contain an __init_.py file)\n subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]\n # if there's some package directories, add a TOC for theses subpackages\n if subs:\n text += title_line('Subpackages', '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L92_C12", "label": "subs =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "vector": [14, 3, 0.3566, 0.0039, 3, 0.77, 0.0, 603, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L95_C12", "label": "subs =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "vector": [14, 3, 0.3682, 0.0039, 3, 0.77, 0.5, 603, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L97_C12", "label": "if", "type": "if", "loc": [97, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "vector": [4, 3, 0.3857, 0.0233, 3, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs:\n text += title_line('Subpackages', '-')\n text += '.. toctree::\\n\\n'\n for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)\n text += '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L100_C16", "label": "for sub", "type": "for", "loc": [100, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L97_C12", "vector": [6, 4, 0.3895, 0.0078, 4, 0.99, 0.0, 819, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "label": "for py_file", "type": "for", "loc": [105, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [6, 2, 0.4283, 0.0465, 2, 0.97, 0.8, 44, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue\n py_file = py_file[:-3]\n py_path = '%s.%s' % (subroot, py_file)\n kind = \"Module\"\n if py_file == '__init__':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L106_C12", "label": "if", "type": "if", "loc": [106, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "vector": [4, 3, 0.4147, 0.0116, 3, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L109_C12", "label": "py_file =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "vector": [14, 3, 0.4225, 0.0039, 3, 0.56, 0.25, 44, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_file = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L110_C12", "label": "py_path =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "vector": [14, 3, 0.4264, 0.0039, 3, 0.56, 0.5, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_path = '%s.%s' % (subroot, py_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L111_C12", "label": "kind =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "vector": [14, 3, 0.4302, 0.0039, 3, 0.56, 0.75, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Module\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L112_C12", "label": "if", "type": "if", "loc": [112, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "vector": [4, 3, 0.436, 0.0078, 3, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if py_file == '__init__':\n kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L113_C16", "label": "kind =", "type": "assigned_variable", "loc": [113, 113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L112_C12", "vector": [14, 4, 0.438, 0.0039, 4, 0.4, 0.0, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "label": "if", "type": "if", "loc": [119, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "vector": [4, 2, 0.4671, 0.0155, 2, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L120_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "vector": [14, 3, 0.4651, 0.0039, 3, 0.67, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L121_C12", "label": "write()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "vector": [8, 3, 0.469, 0.0039, 3, 0.67, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L122_C12", "label": "close()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "vector": [8, 3, 0.4729, 0.0039, 3, 0.67, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "label": "check_for_code", "type": "function", "loc": [124, 134], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.0426, 0, 0.66, 0.6471, 62, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "check_for_code", "arg_names": ["module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_for_code(module):\n \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\"\n fd = open(module, 'r')\n for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L125_C4", "label": "expression", "type": "expression", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "vector": [8, 1, 0.4884, 0.0116, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L128_C4", "label": "fd = open()", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "vector": [14, 1, 0.4961, 0.0039, 1, 0.61, 0.25, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(module, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L129_C4", "label": "for line", "type": "for", "loc": [129, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "vector": [6, 1, 0.5058, 0.0155, 1, 0.61, 0.5, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8", "label": "if", "type": "if", "loc": [130, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L129_C4", "vector": [4, 2, 0.5078, 0.0116, 2, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L131_C12", "label": "close()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8", "vector": [8, 3, 0.5078, 0.0039, 3, 0.65, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L132_C12", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8", "vector": [13, 3, 0.5116, 0.0039, 3, 0.65, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L133_C4", "label": "close()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "vector": [8, 1, 0.5155, 0.0039, 1, 0.61, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L134_C4", "label": "return", "type": "return", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "vector": [13, 1, 0.5194, 0.0039, 1, 0.61, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "label": "recurse_tree", "type": "function", "loc": [136, 172], "level": 0, "parent": null, "vector": [2, 0, 0.5969, 0.1434, 0, 0.66, 0.7059, 12, 0, 3, 0, 0, 0, 0, 14], "semantic": {"name": "recurse_tree", "arg_names": ["path", "excludes", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def recurse_tree(path, excludes, opts):\n \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\"\n toc = []\n excludes = format_excludes(path, excludes)\n tree = os.walk(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L137_C4", "label": "expression", "type": "expression", "loc": [137, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [8, 1, 0.5368, 0.0155, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L141_C4", "label": "toc =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [14, 1, 0.5465, 0.0039, 1, 0.81, 0.2, 360, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "toc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L142_C4", "label": "excludes = format_excludes()", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [14, 1, 0.5504, 0.0039, 1, 0.81, 0.4, 626, 3, 2, 0, 0, 740, 10, 1], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "format_excludes", "annotation": ""}, "snippet": " excludes = format_excludes(path, excludes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L143_C4", "label": "tree = walk()", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [14, 1, 0.5543, 0.0039, 1, 0.81, 0.6, 613, 3, 2, 0, 0, 511, 10, 1], "semantic": {"name": "tree", "arg_names": [], "import_names": [], "rhs_call_name": "walk", "annotation": ""}, "snippet": " tree = os.walk(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "label": "for root, subs, files", "type": "for", "loc": [144, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [6, 1, 0.6047, 0.0969, 1, 0.81, 0.8, 230, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "root, subs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, subs, files in tree:\n # keep only the Python script files\n py_files = check_py_file(files)\n # remove hidden ('.') and private ('_') directories\n subs = [sub for sub in subs if sub[0] not in ['.', '_']]\n # check if there's valid files to process\n if \"/.\" in root or \"/_\" in root \\\n or not py_files \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L146_C8", "label": "py_files = check_py_file()", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "vector": [14, 2, 0.5659, 0.0039, 2, 0.64, 0.0, 318, 3, 1, 0, 0, 422, 10, 1], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "check_py_file", "annotation": ""}, "snippet": " py_files = check_py_file(files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L148_C8", "label": "subs =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "vector": [14, 2, 0.5736, 0.0039, 2, 0.64, 0.25, 603, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if sub[0] not in ['.', '_']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L150_C8", "label": "if", "type": "if", "loc": [150, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "vector": [4, 2, 0.5872, 0.0155, 2, 0.64, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"/.\" in root or \"/_\" in root \\\n or not py_files \\\n or check_excludes(root, excludes):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L154_C8", "label": "subroot = replace()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "vector": [14, 2, 0.5969, 0.0039, 2, 0.64, 0.75, 530, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "subroot", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " subroot = root[len(path):].lstrip('/').replace('/', '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8", "label": "if", "type": "if", "loc": [155, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "vector": [4, 2, 0.626, 0.0543, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root == path:\n # we are at the root level so we create only modules\n for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, module, opts)\n toc.append(module)\n elif not subs and \"__init__.py\" in py_files:\n # we are in a package without sub package"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "label": "for py_file", "type": "for", "loc": [157, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8", "vector": [6, 3, 0.6143, 0.0155, 3, 0.13, 0.0, 44, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, module, opts)\n toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L158_C16", "label": "module =", "type": "assigned_variable", "loc": [158, 158], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "vector": [14, 4, 0.6124, 0.0039, 4, 0.04, 0.0, 98, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " module = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L159_C16", "label": "create_module_file()", "type": "expression", "loc": [159, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "vector": [8, 4, 0.6163, 0.0039, 4, 0.04, 0.5, 545, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_module_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_module_file", "annotation": ""}, "snippet": " create_module_file(root, module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L160_C16", "label": "append()", "type": "expression", "loc": [160, 160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "vector": [8, 4, 0.6202, 0.0039, 4, 0.04, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "label": "if", "type": "if", "loc": [161, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8", "vector": [4, 3, 0.6376, 0.031, 3, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not subs and \"__init__.py\" in py_files:\n # we are in a package without sub package\n create_package_file(root, subroot, py_files, opts=opts)\n toc.append(subroot)\n elif \"__init__.py\" in py_files:\n # we are in package with subpackage(s)\n create_package_file(root, subroot, py_files, opts, subs)\n toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L163_C12", "label": "create_package_file()", "type": "expression", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "vector": [8, 4, 0.6318, 0.0039, 4, 0.15, 0.0, 711, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts=opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L164_C12", "label": "append()", "type": "expression", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "vector": [8, 4, 0.6357, 0.0039, 4, 0.15, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8", "label": "if", "type": "if", "loc": [165, 168], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "vector": [4, 4, 0.6453, 0.0155, 4, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif \"__init__.py\" in py_files:\n # we are in package with subpackage(s)\n create_package_file(root, subroot, py_files, opts, subs)\n toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L167_C12", "label": "create_package_file()", "type": "expression", "loc": [167, 167], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8", "vector": [8, 5, 0.6473, 0.0039, 5, 0.37, 0.0, 711, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts, subs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L168_C12", "label": "append()", "type": "expression", "loc": [168, 168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8", "vector": [8, 5, 0.6512, 0.0039, 5, 0.37, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L171_C4", "label": "if", "type": "if", "loc": [171, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "vector": [4, 1, 0.6647, 0.0078, 1, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.notoc:\n modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L172_C8", "label": "modules_toc()", "type": "expression", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L171_C4", "vector": [8, 2, 0.6667, 0.0039, 2, 0.03, 0.0, 334, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "modules_toc", "arg_names": [], "import_names": [], "rhs_call_name": "modules_toc", "annotation": ""}, "snippet": " modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "label": "modules_toc", "type": "function", "loc": [174, 202], "level": 0, "parent": null, "vector": [2, 0, 0.7287, 0.1124, 0, 0.66, 0.7647, 334, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "modules_toc", "arg_names": ["modules", "opts", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modules_toc(modules, opts, name='modules'):\n \"\"\"\n Create the module's index.\n \"\"\"\n fname = create_file_name(name, opts) \n if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L175_C4", "label": "expression", "type": "expression", "loc": [175, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [8, 1, 0.6822, 0.0116, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the module's index.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L178_C4", "label": "fname = create_file_name()", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [14, 1, 0.6899, 0.0039, 1, 0.44, 0.125, 190, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " fname = create_file_name(name, opts) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4", "label": "if", "type": "if", "loc": [179, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [4, 1, 0.6977, 0.0116, 1, 0.44, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L180_C8", "label": "print()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4", "vector": [8, 2, 0.6977, 0.0039, 2, 0.86, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"File %s already exists.\" % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L181_C8", "label": "return", "type": "return", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4", "vector": [13, 2, 0.7016, 0.0039, 2, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L183_C4", "label": "print()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [8, 1, 0.7093, 0.0039, 1, 0.44, 0.375, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Creating module's index modules.txt.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L184_C4", "label": "text = write_heading()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [14, 1, 0.7132, 0.0039, 1, 0.44, 0.5, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(opts.header, 'Modules')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L189_C4", "label": "sort()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [8, 1, 0.7326, 0.0039, 1, 0.44, 0.625, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " modules.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L190_C4", "label": "prev_module =", "type": "assigned_variable", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [14, 1, 0.7364, 0.0039, 1, 0.44, 0.75, 444, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4", "label": "for module", "type": "for", "loc": [191, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [6, 1, 0.75, 0.0233, 1, 0.44, 0.875, 98, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for module in modules:\n # look if the module is a subpackage and, if yes, ignore it\n if module.startswith(prev_module + '.'):\n continue\n prev_module = module\n text += ' %s\\n' % module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L193_C8", "label": "if", "type": "if", "loc": [193, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4", "vector": [4, 2, 0.75, 0.0078, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if module.startswith(prev_module + '.'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L195_C8", "label": "prev_module =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4", "vector": [14, 2, 0.7558, 0.0039, 2, 0.75, 1.0, 444, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "label": "if", "type": "if", "loc": [199, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "vector": [4, 1, 0.7771, 0.0155, 1, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(fname, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L200_C8", "label": "fd = open()", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "vector": [14, 2, 0.7752, 0.0039, 2, 0.12, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(fname, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L201_C8", "label": "write()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "vector": [8, 2, 0.7791, 0.0039, 2, 0.12, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L202_C8", "label": "close()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "vector": [8, 2, 0.7829, 0.0039, 2, 0.12, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "label": "format_excludes", "type": "function", "loc": [204, 216], "level": 0, "parent": null, "vector": [2, 0, 0.814, 0.0504, 0, 0.66, 0.8235, 740, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "format_excludes", "arg_names": ["path", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def format_excludes(path, excludes):\n \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\"\n f_excludes = []\n for exclude in excludes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L205_C4", "label": "expression", "type": "expression", "loc": [205, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "vector": [8, 1, 0.8023, 0.0194, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L210_C4", "label": "f_excludes =", "type": "assigned_variable", "loc": [210, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "vector": [14, 1, 0.814, 0.0039, 1, 0.69, 0.3333, 109, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f_excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f_excludes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4", "label": "for exclude", "type": "for", "loc": [211, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "vector": [6, 1, 0.8256, 0.0194, 1, 0.69, 0.6667, 739, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)\n # remove trailing slash\n f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L212_C8", "label": "if", "type": "if", "loc": [212, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4", "vector": [4, 2, 0.8236, 0.0078, 2, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L213_C12", "label": "exclude =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L212_C8", "vector": [14, 3, 0.8256, 0.0039, 3, 0.56, 0.0, 739, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L215_C8", "label": "append()", "type": "expression", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4", "vector": [8, 2, 0.8333, 0.0039, 2, 0.35, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L216_C4", "label": "return", "type": "return", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "vector": [13, 1, 0.8372, 0.0039, 1, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f_excludes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "label": "check_excludes", "type": "function", "loc": [218, 225], "level": 0, "parent": null, "vector": [2, 0, 0.8585, 0.031, 0, 0.66, 0.8824, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "check_excludes", "arg_names": ["root", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_excludes(root, excludes):\n \"\"\"\n Check if the directory is in the exclude list.\n \"\"\"\n for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L219_C4", "label": "expression", "type": "expression", "loc": [219, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "vector": [8, 1, 0.8527, 0.0116, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if the directory is in the exclude list.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:For_L222_C4", "label": "for exclude", "type": "for", "loc": [222, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "vector": [6, 1, 0.8643, 0.0116, 1, 0.26, 0.5, 739, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L223_C8", "label": "if", "type": "if", "loc": [223, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:For_L222_C4", "vector": [4, 2, 0.8663, 0.0078, 2, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L224_C12", "label": "return", "type": "return", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L223_C8", "vector": [13, 3, 0.8682, 0.0039, 3, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L225_C4", "label": "return", "type": "return", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "vector": [13, 1, 0.8721, 0.0039, 1, 0.26, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "label": "check_py_file", "type": "function", "loc": [227, 232], "level": 0, "parent": null, "vector": [2, 0, 0.8895, 0.0233, 0, 0.66, 0.9412, 422, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "check_py_file", "arg_names": ["files"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_py_file(files):\n \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\"\n py_files = [fich for fich in files if fich[-3:] == '.py']\n return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L228_C4", "label": "expression", "type": "expression", "loc": [228, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "vector": [8, 1, 0.8876, 0.0116, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L231_C4", "label": "py_files =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "vector": [14, 1, 0.8953, 0.0039, 1, 0.64, 0.5, 318, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_files = [fich for fich in files if fich[-3:] == '.py']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L232_C4", "label": "return", "type": "return", "loc": [232, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "vector": [13, 1, 0.8992, 0.0039, 1, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "label": "if", "type": "if", "loc": [235, 256], "level": 0, "parent": null, "vector": [4, 0, 0.9516, 0.0853, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")\n parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")\n parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")\n parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L237_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [237, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [14, 1, 0.9225, 0.0116, 1, 0.64, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L240_C4", "label": "add_option()", "type": "expression", "loc": [240, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9302, 0.0039, 1, 0.64, 0.1111, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L241_C4", "label": "add_option()", "type": "expression", "loc": [241, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9341, 0.0039, 1, 0.64, 0.2222, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L242_C4", "label": "add_option()", "type": "expression", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.938, 0.0039, 1, 0.64, 0.3333, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L243_C4", "label": "add_option()", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9419, 0.0039, 1, 0.64, 0.4444, 176, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-m\", \"--maxdepth\", action=\"store\", dest=\"maxdepth\", help=\"Maximum depth of submodules to show in the TOC (default=4)\", type=\"int\", default=4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L244_C4", "label": "add_option()", "type": "expression", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9457, 0.0039, 1, 0.64, 0.5556, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-r\", \"--dry-run\", action=\"store_true\", dest=\"dryrun\", help=\"Run the script without creating the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L245_C4", "label": "add_option()", "type": "expression", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9496, 0.0039, 1, 0.64, 0.6667, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-f\", \"--force\", action=\"store_true\", dest=\"force\", help=\"Overwrite all the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L246_C4", "label": "add_option()", "type": "expression", "loc": [246, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [8, 1, 0.9535, 0.0039, 1, 0.64, 0.7778, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-t\", \"--no-toc\", action=\"store_true\", dest=\"notoc\", help=\"Don't create the table of content file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L247_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [247, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [14, 1, 0.9574, 0.0039, 1, 0.64, 0.8889, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4", "label": "if", "type": "if", "loc": [248, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "vector": [4, 1, 0.9767, 0.0349, 1, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) < 1:\n parser.error(\"package path is required.\")\n else:\n if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L249_C8", "label": "error()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4", "vector": [8, 2, 0.9651, 0.0039, 2, 0.78, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"package path is required.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "label": "if", "type": "if", "loc": [251, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4", "vector": [4, 2, 0.9826, 0.0233, 2, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:\n print('%s is not a valid directory.' % args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L253_C12", "label": "excludes =", "type": "assigned_variable", "loc": [253, 253], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "vector": [14, 3, 0.9806, 0.0039, 3, 0.52, 0.0, 626, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " excludes = args[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L254_C12", "label": "recurse_tree()", "type": "expression", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "vector": [8, 3, 0.9845, 0.0039, 3, 0.52, 0.5, 12, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "recurse_tree", "arg_names": [], "import_names": [], "rhs_call_name": "recurse_tree", "annotation": ""}, "snippet": " recurse_tree(args[0], excludes, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L256_C12", "label": "print()", "type": "expression", "loc": [256, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "vector": [8, 3, 0.9922, 0.0039, 3, 0.52, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is not a valid directory.' % args)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L112_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L113_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L159_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:For_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:For_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Return_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Assign_L253_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_749:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_749:Expr_L256_C12"}] |
"""Convert a FAQ (AlterEgo) markdown dump into ReSt documents using pandoc
**Todo**
#. add titles
#. add logging
#. add CLI with optparse
"""
import os
import sys
import glob
import subprocess
import logging
indir = 'faq_markdown'
outdir = 'faq_rst'
inpath = os.path.join('.', indir)
outpath = os.path.join('.', outdir)
pattern = inpath + '/*.txt'
out_ext = 'rst'
for file in glob.glob(pattern):
infile = file
file_basename = os.path.basename(file)
outfile_name = os.path.splitext(file_basename)[0] + '.' + out_ext
outfile = os.path.join(outpath, outfile_name)
# pandoc -s -w rst --toc README -o example6.text
logging.info("converting file %s to format <%s>" % (file_basename, out_ext))
convert_call = ["pandoc",
"-s",
"-w", out_ext,
infile,
"-o", outfile
]
p = subprocess.call(convert_call)
logging.info("Finshed!")
| ajibawa-2023/Python-Code-Large/train/row_750 | 21 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_750:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0952, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Convert a FAQ (AlterEgo) markdown dump into ReSt documents using pandoc\n\n**Todo**\n#. add titles\n#. add logging\n#. add CLI with optparse\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Import_L10_C0", "label": "os import os", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2381, 0.0238, 0, 0.66, 0.0769, 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_750:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2619, 0.0238, 0, 0.66, 0.1538, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Import_L12_C0", "label": "glob import glob", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0238, 0, 0.66, 0.2308, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Import_L13_C0", "label": "subprocess import subprocess", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.3095, 0.0238, 0, 0.66, 0.3077, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Import_L14_C0", "label": "logging import logging", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0238, 0, 0.66, 0.3846, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L16_C0", "label": "indir =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.381, 0.0238, 0, 0.66, 0.4615, 702, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "indir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "indir = 'faq_markdown'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L17_C0", "label": "outdir =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.4048, 0.0238, 0, 0.66, 0.5385, 479, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "outdir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "outdir = 'faq_rst'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L19_C0", "label": "inpath = join()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.4524, 0.0238, 0, 0.66, 0.6154, 95, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "inpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "inpath = os.path.join('.', indir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L20_C0", "label": "outpath = join()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.4762, 0.0238, 0, 0.66, 0.6923, 74, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "outpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "outpath = os.path.join('.', outdir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L22_C0", "label": "pattern =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.5238, 0.0238, 0, 0.66, 0.7692, 561, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pattern", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pattern = inpath + '/*.txt'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L23_C0", "label": "out_ext =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.5476, 0.0238, 0, 0.66, 0.8462, 636, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "out_ext", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "out_ext = 'rst'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "label": "for file", "type": "for", "loc": [26, 39], "level": 0, "parent": null, "vector": [6, 0, 0.7738, 0.3333, 0, 0.66, 0.9231, 107, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for file in glob.glob(pattern):\n infile = file\n file_basename = os.path.basename(file)\n outfile_name = os.path.splitext(file_basename)[0] + '.' + out_ext\n outfile = os.path.join(outpath, outfile_name)\n # pandoc -s -w rst --toc README -o example6.text\n logging.info(\"converting file %s to format <%s>\" % (file_basename, out_ext))\n convert_call = [\"pandoc\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L27_C4", "label": "infile =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.6429, 0.0238, 1, 0.23, 0.0, 463, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "infile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " infile = file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L28_C4", "label": "file_basename = basename()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.6667, 0.0238, 1, 0.23, 0.1667, 437, 3, 1, 0, 0, 164, 10, 1], "semantic": {"name": "file_basename", "arg_names": [], "import_names": [], "rhs_call_name": "basename", "annotation": ""}, "snippet": " file_basename = os.path.basename(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L29_C4", "label": "outfile_name =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.6905, 0.0238, 1, 0.23, 0.3333, 341, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "outfile_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " outfile_name = os.path.splitext(file_basename)[0] + '.' + out_ext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L30_C4", "label": "outfile = join()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.7143, 0.0238, 1, 0.23, 0.5, 206, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "outfile", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " outfile = os.path.join(outpath, outfile_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Expr_L32_C4", "label": "info()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [8, 1, 0.7619, 0.0238, 1, 0.23, 0.6667, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info(\"converting file %s to format <%s>\" % (file_basename, out_ext))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L33_C4", "label": "convert_call =", "type": "assigned_variable", "loc": [33, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.8452, 0.1429, 1, 0.23, 0.8333, 610, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "convert_call", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " convert_call = [\"pandoc\",\n \"-s\",\n \"-w\", out_ext,\n infile,\n \"-o\", outfile\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L39_C4", "label": "p = call()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "vector": [14, 1, 0.9286, 0.0238, 1, 0.23, 1.0, 491, 3, 1, 0, 0, 832, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " p = subprocess.call(convert_call)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_750:Expr_L41_C0", "label": "info()", "type": "expression", "loc": [41, 41], "level": 0, "parent": null, "vector": [8, 0, 0.9762, 0.0238, 0, 0.66, 1.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "logging.info(\"Finshed!\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_750:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_750:Assign_L39_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Sropulpof is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sropulpof. If not, see <http:#www.gnu.org/licenses/>.
"""
This script parse a directory tree looking for python modules and packages and
create ReST files appropriately to create code documentation with Sphinx.
It also create a modules index.
"""
import os
import optparse
# automodule options
options = ['members',
'undoc-members',
# 'inherited-members', # disable because there's a bug in sphinx
'show-inheritance']
def create_file_name(base, opts):
"""Create file name from base name, path and suffix"""
return os.path.join(opts.destdir, "%s.%s" % (base, opts.suffix))
def write_directive(package, module):
"""Create the automodule directive and add the options"""
directive = '.. automodule:: %s.%s\n' % (package, module)
for option in options:
directive += ' :%s:\n' % option
return directive
def write_heading(module, kind='Module'):
"""Create the page heading."""
module = module.title()
heading = title_line(module + ' Documentation', '=')
heading += 'This page contains the %s %s documentation.\n\n' % (module, kind)
return heading
def write_sub(module, kind='Module'):
"""Create the module subtitle"""
sub = title_line('The :mod:`%s` %s' % (module, kind), '-')
return sub
def title_line(title, char):
""" Underline the title with the character pass, with the right length."""
return '%s\n%s\n\n' % (title, len(title) * char)
def create_module_file(root, package, module, opts):
"""Build the text of the file and write the file."""
name = create_file_name(module, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it
print 'Creating file %s for module.' % name
text = write_heading(module)
text += write_sub(module)
text += write_directive(package, module)
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def create_package_file(root, subroot, py_files, opts, subs=None):
"""Build the text of the file and write the file."""
package = root.rpartition('/')[2].lower()
name = create_file_name(subroot, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
else:
print 'Creating file %s for package.' % name
text = write_heading(package, 'Package')
if subs == None:
subs = []
else:
# build a list of directories that are package (they contain an __init_.py file)
subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]
# if there's some package directories, add a TOC for theses subpackages
if subs:
text += title_line('Subpackages', '-')
text += '.. toctree::\n\n'
for sub in subs:
text += ' %s.%s\n' % (subroot, sub)
text += '\n'
# add each package's module
for py_file in py_files:
if not check_for_code('%s/%s' % (root, py_file)):
# don't build the file if there's no code in it
continue
py_file = py_file[:-3]
py_path = '%s.%s' % (subroot, py_file)
kind = "Module"
if py_file == '__init__':
kind = "Package"
text += write_sub(kind == 'Package' and package or py_file, kind)
text += write_directive(kind == "Package" and subroot or py_path)
text += '\n'
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def check_for_code(module):
"""
Check if there's at least one class or one function in the module.
"""
fd = open(module, 'r')
for line in fd:
if line.startswith('def ') or line.startswith('class '):
fd.close()
return True
fd.close()
return False
def recurse_tree(path, excludes, opts):
"""
Look for every file in the directory tree and create the corresponding
ReST files.
"""
package_name = os.path.split(path)[-1]
print 'package name', package_name
toc = []
excludes = format_excludes(path, excludes)
tree = os.walk(path, False)
for root, subs, files in tree:
# keep only the Python script files
py_files = check_py_file(files)
# remove hidden ('.') and private ('_') directories
subs = [sub for sub in subs if sub[0] not in ['.', '_']]
# check if there's valid files to process
if "/." in root or "/_" in root \
or not py_files \
or check_excludes(root, excludes):
continue
subroot = root[len(path):].lstrip('/').replace('/', '.')
if root == path:
# we are at the root level so we create only modules
for py_file in py_files:
module = py_file[:-3]
create_module_file(root, package_name, module, opts)
if not check_for_code(os.path.join(path, module+'.py')):
# don't build the file if there's no code in it
pass
else:
toc.append(module)
elif not subs and "__init__.py" in py_files:
# we are in a package without sub package
create_package_file(root, subroot, py_files, opts=opts)
# FIXME: HERE THE __init__.py should go into the toc only if it contains
# code!
if not check_for_code(subroot):
# don't build the file if there's no code in it
continue
toc.append(subroot)
print 'here'
elif "__init__.py" in py_files:
# we are in package with subpackage(s)
create_package_file(root, subroot, py_files, opts, subs)
toc.append(subroot)
print 'hello'
# create the module's index
if not opts.notoc:
modules_toc(toc, opts)
def modules_toc(modules, opts, name='modules'):
"""
Create the module's index.
"""
fname = create_file_name(name, opts)
if not opts.force and os.path.exists(fname):
print "File %s already exists." % name
return
print "Creating module's index modules.txt."
text = write_heading(opts.header, 'Modules')
text += title_line('Modules:', '-')
text += '.. toctree::\n'
text += ' :maxdepth: %s\n\n' % opts.maxdepth
modules.sort()
prev_module = ''
for module in modules:
# look if the module is a subpackage and, if yes, ignore it
if module.startswith(prev_module + '.'):
continue
prev_module = module
text += ' %s\n' % module
# write the file
if not opts.dryrun:
fd = open(fname, 'w')
fd.write(text)
fd.close()
def format_excludes(path, excludes):
"""
Format the excluded directory list.
(verify that the path is not from the root of the volume or the root of the
package)
"""
f_excludes = []
for exclude in excludes:
if exclude[0] != '/' and exclude[:len(path)] != path:
exclude = '%s/%s' % (path, exclude)
# remove trailing slash
f_excludes.append(exclude.rstrip('/'))
return f_excludes
def check_excludes(root, excludes):
"""
Check if the directory is in the exclude list.
"""
for exclude in excludes:
if root[:len(exclude)] == exclude:
return True
return False
def check_py_file(files):
"""
Return a list with only the python scripts (remove all other files).
"""
py_files = [fich for fich in files if fich[-3:] == '.py']
return py_files
if __name__ == '__main__':
parser = optparse.OptionParser(usage="""usage: %prog [options] <package path> [exclude paths, ...]
Note: By default this script will not overwrite already created files.""")
parser.add_option("-n", "--doc-header", action="store", dest="header", help="Documentation Header (default=Project)", default="Project")
parser.add_option("-d", "--dest-dir", action="store", dest="destdir", help="Output destination directory", default="")
parser.add_option("-s", "--suffix", action="store", dest="suffix", help="module suffix (default=txt)", default="txt")
parser.add_option("-m", "--maxdepth", action="store", dest="maxdepth", help="Maximum depth of submodules to show in the TOC (default=4)", type="int", default=4)
parser.add_option("-r", "--dry-run", action="store_true", dest="dryrun", help="Run the script without creating the files")
parser.add_option("-f", "--force", action="store_true", dest="force", help="Overwrite all the files")
parser.add_option("-t", "--no-toc", action="store_true", dest="notoc", help="Don't create the table of content file")
(opts, args) = parser.parse_args()
if len(args) < 1:
parser.error("package path is required.")
else:
if os.path.isdir(args[0]):
# if there's some exclude arguments, build the list of excludes
excludes = args[1:]
recurse_tree(args[0], excludes, opts)
else:
print '%s is not a valid directory.' % args
| ajibawa-2023/Python-Code-Large/train/row_751 | 149 | 271 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.0886, 0.0185, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis script parse a directory tree looking for python modules and packages and\ncreate ReST files appropriately to create code documentation with Sphinx.\nIt also create a modules index. \n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Import_L28_C0", "label": "os import os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1033, 0.0037, 0, 0.66, 0.0588, 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_751:Import_L29_C0", "label": "optparse import optparse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.107, 0.0037, 0, 0.66, 0.1176, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L33_C0", "label": "options =", "type": "assigned_variable", "loc": [33, 36], "level": 0, "parent": null, "vector": [14, 0, 0.1273, 0.0148, 0, 0.66, 0.1765, 707, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options = ['members',\n 'undoc-members',\n# 'inherited-members', # disable because there's a bug in sphinx\n 'show-inheritance']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "label": "create_file_name", "type": "function", "loc": [38, 40], "level": 0, "parent": null, "vector": [2, 0, 0.1439, 0.0111, 0, 0.66, 0.2353, 96, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "create_file_name", "arg_names": ["base", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_file_name(base, opts):\n \"\"\"Create file name from base name, path and suffix\"\"\"\n return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "vector": [8, 1, 0.1439, 0.0037, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create file name from base name, path and suffix\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "vector": [13, 1, 0.1476, 0.0037, 1, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "label": "write_directive", "type": "function", "loc": [42, 47], "level": 0, "parent": null, "vector": [2, 0, 0.1642, 0.0221, 0, 0.66, 0.2941, 996, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "write_directive", "arg_names": ["package", "module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_directive(package, module):\n \"\"\"Create the automodule directive and add the options\"\"\"\n directive = '.. automodule:: %s.%s\\n' % (package, module)\n for option in options:\n directive += ' :%s:\\n' % option\n return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "vector": [8, 1, 0.1587, 0.0037, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the automodule directive and add the options\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L44_C4", "label": "directive =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "vector": [14, 1, 0.1624, 0.0037, 1, 0.36, 0.3333, 677, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "directive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " directive = '.. automodule:: %s.%s\\n' % (package, module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L45_C4", "label": "for option", "type": "for", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "vector": [6, 1, 0.1679, 0.0074, 1, 0.36, 0.6667, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for option in options:\n directive += ' :%s:\\n' % option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "vector": [13, 1, 0.1734, 0.0037, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "label": "write_heading", "type": "function", "loc": [49, 54], "level": 0, "parent": null, "vector": [2, 0, 0.19, 0.0221, 0, 0.66, 0.3529, 573, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "write_heading", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_heading(module, kind='Module'):\n \"\"\"Create the page heading.\"\"\"\n module = module.title()\n heading = title_line(module + ' Documentation', '=')\n heading += 'This page contains the %s %s documentation.\\n\\n' % (module, kind)\n return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "vector": [8, 1, 0.1845, 0.0037, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the page heading.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L51_C4", "label": "module = title()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "vector": [14, 1, 0.1882, 0.0037, 1, 0.03, 0.3333, 98, 3, 0, 0, 0, 48, 10, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " module = module.title()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L52_C4", "label": "heading = title_line()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "vector": [14, 1, 0.1919, 0.0037, 1, 0.03, 0.6667, 841, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "heading", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " heading = title_line(module + ' Documentation', '=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L54_C4", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "vector": [13, 1, 0.1993, 0.0037, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "label": "write_sub", "type": "function", "loc": [56, 59], "level": 0, "parent": null, "vector": [2, 0, 0.2122, 0.0148, 0, 0.66, 0.4118, 320, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "write_sub", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_sub(module, kind='Module'):\n \"\"\"Create the module subtitle\"\"\"\n sub = title_line('The :mod:`%s` %s' % (module, kind), '-')\n return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "vector": [8, 1, 0.2103, 0.0037, 1, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the module subtitle\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L58_C4", "label": "sub = title_line()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "vector": [14, 1, 0.214, 0.0037, 1, 0.5, 0.5, 819, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " sub = title_line('The :mod:`%s` %s' % (module, kind), '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "vector": [13, 1, 0.2177, 0.0037, 1, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L61_C0", "label": "title_line", "type": "function", "loc": [61, 63], "level": 0, "parent": null, "vector": [2, 0, 0.2288, 0.0111, 0, 0.66, 0.4706, 810, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "title_line", "arg_names": ["title", "char"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def title_line(title, char):\n \"\"\" Underline the title with the character pass, with the right length.\"\"\"\n return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L61_C0", "vector": [8, 1, 0.2288, 0.0037, 1, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Underline the title with the character pass, with the right length.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L61_C0", "vector": [13, 1, 0.2325, 0.0037, 1, 0.12, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "label": "create_module_file", "type": "function", "loc": [65, 80], "level": 0, "parent": null, "vector": [2, 0, 0.2675, 0.059, 0, 0.66, 0.5294, 545, 0, 4, 0, 0, 0, 0, 11], "semantic": {"name": "create_module_file", "arg_names": ["root", "package", "module", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_module_file(root, package, module, opts):\n \"\"\"Build the text of the file and write the file.\"\"\"\n name = create_file_name(module, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L66_C4", "label": "expression", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "vector": [8, 1, 0.2435, 0.0037, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L67_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "vector": [14, 1, 0.2472, 0.0037, 1, 0.77, 0.5, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4", "label": "if", "type": "if", "loc": [68, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "vector": [4, 1, 0.2731, 0.048, 1, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(package, module)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L69_C8", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4", "vector": [8, 2, 0.2546, 0.0037, 2, 0.32, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "label": "if", "type": "if", "loc": [70, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4", "vector": [4, 2, 0.2768, 0.0406, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(package, module)\n\n # write the file\n if not opts.dryrun: "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L71_C8", "label": "print()", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "vector": [8, 3, 0.262, 0.0037, 3, 0.62, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for module.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L72_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "vector": [14, 3, 0.2657, 0.0037, 3, 0.62, 0.5, 439, 3, 1, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "label": "if", "type": "if", "loc": [77, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "vector": [4, 3, 0.2897, 0.0148, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L78_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "vector": [14, 4, 0.2878, 0.0037, 4, 0.74, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L79_C12", "label": "write()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "vector": [8, 4, 0.2915, 0.0037, 4, 0.74, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L80_C12", "label": "close()", "type": "expression", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "vector": [8, 4, 0.2952, 0.0037, 4, 0.74, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "label": "create_package_file", "type": "function", "loc": [82, 122], "level": 0, "parent": null, "vector": [2, 0, 0.3764, 0.1513, 0, 0.66, 0.5882, 711, 0, 5, 0, 0, 0, 0, 15], "semantic": {"name": "create_package_file", "arg_names": ["root", "subroot", "py_files", "opts", "subs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_package_file(root, subroot, py_files, opts, subs=None):\n \"\"\"Build the text of the file and write the file.\"\"\"\n package = root.rpartition('/')[2].lower()\n name = create_file_name(subroot, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L83_C4", "label": "expression", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "vector": [8, 1, 0.3063, 0.0037, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L84_C4", "label": "package = lower()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "vector": [14, 1, 0.31, 0.0037, 1, 0.28, 0.3333, 187, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "package", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " package = root.rpartition('/')[2].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L85_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "vector": [14, 1, 0.3137, 0.0037, 1, 0.28, 0.6667, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(subroot, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "label": "if", "type": "if", "loc": [86, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "vector": [4, 1, 0.3838, 0.1365, 1, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)\n text = write_heading(package, 'Package')\n if subs == None:\n subs = []\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L87_C8", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [8, 2, 0.321, 0.0037, 2, 0.96, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L89_C8", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [8, 2, 0.3284, 0.0037, 2, 0.96, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L90_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [14, 2, 0.3321, 0.0037, 2, 0.96, 0.4, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(package, 'Package')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "label": "if", "type": "if", "loc": [91, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [4, 2, 0.3561, 0.0443, 2, 0.96, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs == None:\n subs = []\n else:\n # build a list of directories that are package (they contain an __init_.py file)\n subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]\n # if there's some package directories, add a TOC for theses subpackages\n if subs:\n text += title_line('Subpackages', '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L92_C12", "label": "subs =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "vector": [14, 3, 0.3395, 0.0037, 3, 0.59, 0.0, 603, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L95_C12", "label": "subs =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "vector": [14, 3, 0.3506, 0.0037, 3, 0.59, 0.5, 603, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L97_C12", "label": "if", "type": "if", "loc": [97, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "vector": [4, 3, 0.3672, 0.0221, 3, 0.59, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs:\n text += title_line('Subpackages', '-')\n text += '.. toctree::\\n\\n'\n for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)\n text += '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L100_C16", "label": "for sub", "type": "for", "loc": [100, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L97_C12", "vector": [6, 4, 0.3708, 0.0074, 4, 0.53, 0.0, 819, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "label": "for py_file", "type": "for", "loc": [105, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [6, 2, 0.4077, 0.0443, 2, 0.96, 0.8, 44, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue\n py_file = py_file[:-3]\n py_path = '%s.%s' % (subroot, py_file)\n kind = \"Module\"\n if py_file == '__init__':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L106_C12", "label": "if", "type": "if", "loc": [106, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "vector": [4, 3, 0.3948, 0.0111, 3, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L109_C12", "label": "py_file =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "vector": [14, 3, 0.4022, 0.0037, 3, 0.21, 0.25, 44, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_file = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L110_C12", "label": "py_path =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "vector": [14, 3, 0.4059, 0.0037, 3, 0.21, 0.5, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_path = '%s.%s' % (subroot, py_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L111_C12", "label": "kind =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "vector": [14, 3, 0.4096, 0.0037, 3, 0.21, 0.75, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Module\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L112_C12", "label": "if", "type": "if", "loc": [112, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "vector": [4, 3, 0.4151, 0.0074, 3, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if py_file == '__init__':\n kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L113_C16", "label": "kind =", "type": "assigned_variable", "loc": [113, 113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L112_C12", "vector": [14, 4, 0.417, 0.0037, 4, 0.03, 0.0, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "label": "if", "type": "if", "loc": [119, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "vector": [4, 2, 0.4446, 0.0148, 2, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L120_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "vector": [14, 3, 0.4428, 0.0037, 3, 0.74, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L121_C12", "label": "write()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "vector": [8, 3, 0.4465, 0.0037, 3, 0.74, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L122_C12", "label": "close()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "vector": [8, 3, 0.4502, 0.0037, 3, 0.74, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "label": "check_for_code", "type": "function", "loc": [124, 134], "level": 0, "parent": null, "vector": [2, 0, 0.476, 0.0406, 0, 0.66, 0.6471, 62, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "check_for_code", "arg_names": ["module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_for_code(module):\n \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\"\n fd = open(module, 'r')\n for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L125_C4", "label": "expression", "type": "expression", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "vector": [8, 1, 0.4649, 0.0111, 1, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L128_C4", "label": "fd = open()", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "vector": [14, 1, 0.4723, 0.0037, 1, 0.12, 0.25, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(module, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L129_C4", "label": "for line", "type": "for", "loc": [129, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "vector": [6, 1, 0.4815, 0.0148, 1, 0.12, 0.5, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8", "label": "if", "type": "if", "loc": [130, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L129_C4", "vector": [4, 2, 0.4834, 0.0111, 2, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L131_C12", "label": "close()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8", "vector": [8, 3, 0.4834, 0.0037, 3, 0.98, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L132_C12", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8", "vector": [13, 3, 0.4871, 0.0037, 3, 0.98, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L133_C4", "label": "close()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "vector": [8, 1, 0.4908, 0.0037, 1, 0.12, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L134_C4", "label": "return", "type": "return", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "vector": [13, 1, 0.4945, 0.0037, 1, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "label": "recurse_tree", "type": "function", "loc": [136, 185], "level": 0, "parent": null, "vector": [2, 0, 0.5923, 0.1845, 0, 0.66, 0.7059, 12, 0, 3, 0, 0, 0, 0, 21], "semantic": {"name": "recurse_tree", "arg_names": ["path", "excludes", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def recurse_tree(path, excludes, opts):\n \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\"\n package_name = os.path.split(path)[-1]\n print('package name', package_name)\n toc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L137_C4", "label": "expression", "type": "expression", "loc": [137, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [8, 1, 0.5111, 0.0148, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L141_C4", "label": "package_name =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [14, 1, 0.5203, 0.0037, 1, 0.89, 0.1429, 152, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "package_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " package_name = os.path.split(path)[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L142_C4", "label": "print()", "type": "expression", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [8, 1, 0.524, 0.0037, 1, 0.89, 0.2857, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('package name', package_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L143_C4", "label": "toc =", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [14, 1, 0.5277, 0.0037, 1, 0.89, 0.4286, 360, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "toc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L144_C4", "label": "excludes = format_excludes()", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [14, 1, 0.5314, 0.0037, 1, 0.89, 0.5714, 626, 3, 2, 0, 0, 740, 10, 1], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "format_excludes", "annotation": ""}, "snippet": " excludes = format_excludes(path, excludes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L145_C4", "label": "tree = walk()", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [14, 1, 0.5351, 0.0037, 1, 0.89, 0.7143, 613, 3, 2, 0, 0, 511, 10, 1], "semantic": {"name": "tree", "arg_names": [], "import_names": [], "rhs_call_name": "walk", "annotation": ""}, "snippet": " tree = os.walk(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "label": "for root, subs, files", "type": "for", "loc": [146, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [6, 1, 0.6033, 0.1328, 1, 0.89, 0.8571, 230, 2, 0, 0, 0, 0, 0, 16], "semantic": {"name": "root, subs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, subs, files in tree:\n # keep only the Python script files\n py_files = check_py_file(files)\n # remove hidden ('.') and private ('_') directories\n subs = [sub for sub in subs if sub[0] not in ['.', '_']]\n # check if there's valid files to process\n if \"/.\" in root or \"/_\" in root \\\n or not py_files \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L148_C8", "label": "py_files = check_py_file()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "vector": [14, 2, 0.5461, 0.0037, 2, 0.36, 0.0, 318, 3, 1, 0, 0, 422, 10, 1], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "check_py_file", "annotation": ""}, "snippet": " py_files = check_py_file(files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L150_C8", "label": "subs =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "vector": [14, 2, 0.5535, 0.0037, 2, 0.36, 0.25, 603, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if sub[0] not in ['.', '_']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L152_C8", "label": "if", "type": "if", "loc": [152, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "vector": [4, 2, 0.5664, 0.0148, 2, 0.36, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"/.\" in root or \"/_\" in root \\\n or not py_files \\\n or check_excludes(root, excludes):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L156_C8", "label": "subroot = replace()", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "vector": [14, 2, 0.5756, 0.0037, 2, 0.36, 0.75, 530, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "subroot", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " subroot = root[len(path):].lstrip('/').replace('/', '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8", "label": "if", "type": "if", "loc": [157, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "vector": [4, 2, 0.6236, 0.0923, 2, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root == path:\n # we are at the root level so we create only modules\n for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, package_name, module, opts)\n if not check_for_code(os.path.join(path, module+'.py')):\n # don't build the file if there's no code in it\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "label": "for py_file", "type": "for", "loc": [159, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8", "vector": [6, 3, 0.5996, 0.0295, 3, 0.15, 0.0, 44, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, package_name, module, opts)\n if not check_for_code(os.path.join(path, module+'.py')):\n # don't build the file if there's no code in it\n pass\n else:\n toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L160_C16", "label": "module =", "type": "assigned_variable", "loc": [160, 160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "vector": [14, 4, 0.5904, 0.0037, 4, 0.9, 0.0, 98, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " module = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L161_C16", "label": "create_module_file()", "type": "expression", "loc": [161, 161], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "vector": [8, 4, 0.5941, 0.0037, 4, 0.9, 0.5, 545, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_module_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_module_file", "annotation": ""}, "snippet": " create_module_file(root, package_name, module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L162_C16", "label": "if", "type": "if", "loc": [162, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "vector": [4, 4, 0.6052, 0.0185, 4, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not check_for_code(os.path.join(path, module+'.py')):\n # don't build the file if there's no code in it\n pass\n else:\n toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L166_C20", "label": "append()", "type": "expression", "loc": [166, 166], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L162_C16", "vector": [8, 5, 0.6125, 0.0037, 5, 0.58, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "label": "if", "type": "if", "loc": [167, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8", "vector": [4, 3, 0.6421, 0.0554, 3, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not subs and \"__init__.py\" in py_files:\n # we are in a package without sub package\n create_package_file(root, subroot, py_files, opts=opts)\n # FIXME: HERE THE __init__.py should go into the toc only if it contains \n # code!\n if not check_for_code(subroot):\n # don't build the file if there's no code in it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L169_C12", "label": "create_package_file()", "type": "expression", "loc": [169, 169], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "vector": [8, 4, 0.6236, 0.0037, 4, 0.98, 0.0, 711, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts=opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L172_C12", "label": "if", "type": "if", "loc": [172, 174], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "vector": [4, 4, 0.6384, 0.0111, 4, 0.98, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not check_for_code(subroot):\n # don't build the file if there's no code in it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L175_C12", "label": "append()", "type": "expression", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "vector": [8, 4, 0.6458, 0.0037, 4, 0.98, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L176_C12", "label": "print()", "type": "expression", "loc": [176, 176], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "vector": [8, 4, 0.6494, 0.0037, 4, 0.98, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('here')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "label": "if", "type": "if", "loc": [177, 181], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "vector": [4, 4, 0.6605, 0.0185, 4, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif \"__init__.py\" in py_files:\n # we are in package with subpackage(s)\n create_package_file(root, subroot, py_files, opts, subs)\n toc.append(subroot)\n print('hello')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L179_C12", "label": "create_package_file()", "type": "expression", "loc": [179, 179], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "vector": [8, 5, 0.6605, 0.0037, 5, 0.61, 0.0, 711, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts, subs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L180_C12", "label": "append()", "type": "expression", "loc": [180, 180], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "vector": [8, 5, 0.6642, 0.0037, 5, 0.61, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L181_C12", "label": "print()", "type": "expression", "loc": [181, 181], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "vector": [8, 5, 0.6679, 0.0037, 5, 0.61, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('hello')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L184_C4", "label": "if", "type": "if", "loc": [184, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "vector": [4, 1, 0.6808, 0.0074, 1, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.notoc:\n modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L185_C8", "label": "modules_toc()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L184_C4", "vector": [8, 2, 0.6827, 0.0037, 2, 0.2, 0.0, 334, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "modules_toc", "arg_names": [], "import_names": [], "rhs_call_name": "modules_toc", "annotation": ""}, "snippet": " modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "label": "modules_toc", "type": "function", "loc": [187, 215], "level": 0, "parent": null, "vector": [2, 0, 0.7417, 0.107, 0, 0.66, 0.7647, 334, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "modules_toc", "arg_names": ["modules", "opts", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modules_toc(modules, opts, name='modules'):\n \"\"\"\n Create the module's index.\n \"\"\"\n fname = create_file_name(name, opts) \n if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L188_C4", "label": "expression", "type": "expression", "loc": [188, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [8, 1, 0.6974, 0.0111, 1, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the module's index.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L191_C4", "label": "fname = create_file_name()", "type": "assigned_variable", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [14, 1, 0.7048, 0.0037, 1, 0.63, 0.125, 190, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " fname = create_file_name(name, opts) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4", "label": "if", "type": "if", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [4, 1, 0.7122, 0.0111, 1, 0.63, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L193_C8", "label": "print()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4", "vector": [8, 2, 0.7122, 0.0037, 2, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"File %s already exists.\" % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L194_C8", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4", "vector": [13, 2, 0.7159, 0.0037, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L196_C4", "label": "print()", "type": "expression", "loc": [196, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [8, 1, 0.7232, 0.0037, 1, 0.63, 0.375, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Creating module's index modules.txt.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L197_C4", "label": "text = write_heading()", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [14, 1, 0.7269, 0.0037, 1, 0.63, 0.5, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(opts.header, 'Modules')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L202_C4", "label": "sort()", "type": "expression", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [8, 1, 0.7454, 0.0037, 1, 0.63, 0.625, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " modules.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L203_C4", "label": "prev_module =", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [14, 1, 0.7491, 0.0037, 1, 0.63, 0.75, 444, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4", "label": "for module", "type": "for", "loc": [204, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [6, 1, 0.762, 0.0221, 1, 0.63, 0.875, 98, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for module in modules:\n # look if the module is a subpackage and, if yes, ignore it\n if module.startswith(prev_module + '.'):\n continue\n prev_module = module\n text += ' %s\\n' % module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L206_C8", "label": "if", "type": "if", "loc": [206, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4", "vector": [4, 2, 0.762, 0.0074, 2, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if module.startswith(prev_module + '.'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L208_C8", "label": "prev_module =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4", "vector": [14, 2, 0.7675, 0.0037, 2, 0.14, 1.0, 444, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "label": "if", "type": "if", "loc": [212, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "vector": [4, 1, 0.7878, 0.0148, 1, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(fname, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L213_C8", "label": "fd = open()", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "vector": [14, 2, 0.786, 0.0037, 2, 0.21, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(fname, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L214_C8", "label": "write()", "type": "expression", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "vector": [8, 2, 0.7897, 0.0037, 2, 0.21, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L215_C8", "label": "close()", "type": "expression", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "vector": [8, 2, 0.7934, 0.0037, 2, 0.21, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "label": "format_excludes", "type": "function", "loc": [217, 229], "level": 0, "parent": null, "vector": [2, 0, 0.8229, 0.048, 0, 0.66, 0.8235, 740, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "format_excludes", "arg_names": ["path", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def format_excludes(path, excludes):\n \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\"\n f_excludes = []\n for exclude in excludes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L218_C4", "label": "expression", "type": "expression", "loc": [218, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "vector": [8, 1, 0.8118, 0.0185, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L223_C4", "label": "f_excludes =", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "vector": [14, 1, 0.8229, 0.0037, 1, 0.01, 0.3333, 109, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f_excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f_excludes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4", "label": "for exclude", "type": "for", "loc": [224, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "vector": [6, 1, 0.8339, 0.0185, 1, 0.01, 0.6667, 739, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)\n # remove trailing slash\n f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L225_C8", "label": "if", "type": "if", "loc": [225, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4", "vector": [4, 2, 0.8321, 0.0074, 2, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L226_C12", "label": "exclude =", "type": "assigned_variable", "loc": [226, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L225_C8", "vector": [14, 3, 0.8339, 0.0037, 3, 0.29, 0.0, 739, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L228_C8", "label": "append()", "type": "expression", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4", "vector": [8, 2, 0.8413, 0.0037, 2, 0.42, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L229_C4", "label": "return", "type": "return", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "vector": [13, 1, 0.845, 0.0037, 1, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f_excludes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "label": "check_excludes", "type": "function", "loc": [231, 238], "level": 0, "parent": null, "vector": [2, 0, 0.8653, 0.0295, 0, 0.66, 0.8824, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "check_excludes", "arg_names": ["root", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_excludes(root, excludes):\n \"\"\"\n Check if the directory is in the exclude list.\n \"\"\"\n for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L232_C4", "label": "expression", "type": "expression", "loc": [232, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "vector": [8, 1, 0.8598, 0.0111, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if the directory is in the exclude list.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:For_L235_C4", "label": "for exclude", "type": "for", "loc": [235, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "vector": [6, 1, 0.8708, 0.0111, 1, 0.24, 0.5, 739, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L236_C8", "label": "if", "type": "if", "loc": [236, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:For_L235_C4", "vector": [4, 2, 0.8727, 0.0074, 2, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L237_C12", "label": "return", "type": "return", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L236_C8", "vector": [13, 3, 0.8745, 0.0037, 3, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L238_C4", "label": "return", "type": "return", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "vector": [13, 1, 0.8782, 0.0037, 1, 0.24, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "label": "check_py_file", "type": "function", "loc": [240, 245], "level": 0, "parent": null, "vector": [2, 0, 0.8948, 0.0221, 0, 0.66, 0.9412, 422, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "check_py_file", "arg_names": ["files"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_py_file(files):\n \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\"\n py_files = [fich for fich in files if fich[-3:] == '.py']\n return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L241_C4", "label": "expression", "type": "expression", "loc": [241, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "vector": [8, 1, 0.893, 0.0111, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L244_C4", "label": "py_files =", "type": "assigned_variable", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "vector": [14, 1, 0.9004, 0.0037, 1, 0.07, 0.5, 318, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_files = [fich for fich in files if fich[-3:] == '.py']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L245_C4", "label": "return", "type": "return", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "vector": [13, 1, 0.9041, 0.0037, 1, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "label": "if", "type": "if", "loc": [248, 269], "level": 0, "parent": null, "vector": [4, 0, 0.9539, 0.0812, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")\n parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")\n parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")\n parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L250_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [250, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [14, 1, 0.9262, 0.0111, 1, 0.15, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L253_C4", "label": "add_option()", "type": "expression", "loc": [253, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.9336, 0.0037, 1, 0.15, 0.1111, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L254_C4", "label": "add_option()", "type": "expression", "loc": [254, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.9373, 0.0037, 1, 0.15, 0.2222, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L255_C4", "label": "add_option()", "type": "expression", "loc": [255, 255], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.941, 0.0037, 1, 0.15, 0.3333, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L256_C4", "label": "add_option()", "type": "expression", "loc": [256, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.9446, 0.0037, 1, 0.15, 0.4444, 176, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-m\", \"--maxdepth\", action=\"store\", dest=\"maxdepth\", help=\"Maximum depth of submodules to show in the TOC (default=4)\", type=\"int\", default=4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L257_C4", "label": "add_option()", "type": "expression", "loc": [257, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.9483, 0.0037, 1, 0.15, 0.5556, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-r\", \"--dry-run\", action=\"store_true\", dest=\"dryrun\", help=\"Run the script without creating the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L258_C4", "label": "add_option()", "type": "expression", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.952, 0.0037, 1, 0.15, 0.6667, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-f\", \"--force\", action=\"store_true\", dest=\"force\", help=\"Overwrite all the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L259_C4", "label": "add_option()", "type": "expression", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [8, 1, 0.9557, 0.0037, 1, 0.15, 0.7778, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-t\", \"--no-toc\", action=\"store_true\", dest=\"notoc\", help=\"Don't create the table of content file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L260_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [14, 1, 0.9594, 0.0037, 1, 0.15, 0.8889, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4", "label": "if", "type": "if", "loc": [261, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "vector": [4, 1, 0.9779, 0.0332, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) < 1:\n parser.error(\"package path is required.\")\n else:\n if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L262_C8", "label": "error()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4", "vector": [8, 2, 0.9668, 0.0037, 2, 0.3, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"package path is required.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "label": "if", "type": "if", "loc": [264, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4", "vector": [4, 2, 0.9834, 0.0221, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:\n print('%s is not a valid directory.' % args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L266_C12", "label": "excludes =", "type": "assigned_variable", "loc": [266, 266], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "vector": [14, 3, 0.9815, 0.0037, 3, 0.82, 0.0, 626, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " excludes = args[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L267_C12", "label": "recurse_tree()", "type": "expression", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "vector": [8, 3, 0.9852, 0.0037, 3, 0.82, 0.5, 12, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "recurse_tree", "arg_names": [], "import_names": [], "rhs_call_name": "recurse_tree", "annotation": ""}, "snippet": " recurse_tree(args[0], excludes, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L269_C12", "label": "print()", "type": "expression", "loc": [269, 269], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "vector": [8, 3, 0.9926, 0.0037, 3, 0.82, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is not a valid directory.' % args)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L112_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L113_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L161_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L159_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L162_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L162_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L166_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L157_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L225_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L226_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L217_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:For_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:For_L235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L236_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Return_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Assign_L266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_751:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_751:Expr_L269_C12"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sropulpof
# Copyright (C) 2008 Société des arts technologiques (SAT)
# http://www.sat.qc.ca
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Sropulpof is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sropulpof. If not, see <http:#www.gnu.org/licenses/>.
"""
This script parse a directory tree looking for python modules and packages and
create ReST files appropriately to create code documentation with Sphinx.
It also create a modules index.
"""
import os
import optparse
# automodule options
options = ['members',
'undoc-members',
# 'inherited-members', # disable because there's a bug in sphinx
'show-inheritance']
def create_file_name(base, opts):
"""Create file name from base name, path and suffix"""
return os.path.join(opts.destdir, "%s.%s" % (base, opts.suffix))
def write_directive(module):
"""Create the automodule directive and add the options"""
directive = '.. automodule:: %s\n' % module
for option in options:
directive += ' :%s:\n' % option
return directive
def write_heading(module, kind='Module'):
"""Create the page heading."""
module = module.title()
heading = title_line(module + ' Documentation', '=')
heading += 'This page contains the %s %s documentation.\n\n' % (module, kind)
return heading
def write_sub(module, kind='Module'):
"""Create the module subtitle"""
sub = title_line('The :mod:`%s` %s' % (module, kind), '-')
return sub
def title_line(title, char):
""" Underline the title with the character pass, with the right length."""
return '%s\n%s\n\n' % (title, len(title) * char)
def create_module_file(root, module, opts):
"""Build the text of the file and write the file."""
name = create_file_name(module, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it
print 'Creating file %s for module.' % name
text = write_heading(module)
text += write_sub(module)
text += write_directive(module)
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def create_package_file(root, subroot, py_files, opts, subs=None):
"""Build the text of the file and write the file."""
package = root.rpartition('/')[2].lower()
name = create_file_name(subroot, opts)
if not opts.force and os.path.isfile(name):
print 'File %s already exists.' % name
else:
print 'Creating file %s for package.' % name
text = write_heading(package, 'Package')
if subs == None:
subs = []
else:
# build a list of directories that are package (they contain an __init_.py file)
subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]
# if there's some package directories, add a TOC for theses subpackages
if subs:
text += title_line('Subpackages', '-')
text += '.. toctree::\n\n'
for sub in subs:
text += ' %s.%s\n' % (subroot, sub)
text += '\n'
# add each package's module
for py_file in py_files:
if not check_for_code('%s/%s' % (root, py_file)):
# don't build the file if there's no code in it
continue
py_file = py_file[:-3]
py_path = '%s.%s' % (subroot, py_file)
kind = "Module"
if py_file == '__init__':
kind = "Package"
text += write_sub(kind == 'Package' and package or py_file, kind)
text += write_directive(kind == "Package" and subroot or py_path)
text += '\n'
# write the file
if not opts.dryrun:
fd = open(name, 'w')
fd.write(text)
fd.close()
def check_for_code(module):
"""
Check if there's at least one class or one function in the module.
"""
fd = open(module, 'r')
for line in fd:
if line.startswith('def ') or line.startswith('class '):
fd.close()
return True
fd.close()
return False
def recurse_tree(path, excludes, opts):
"""
Look for every file in the directory tree and create the corresponding
ReST files.
"""
toc = []
excludes = format_excludes(path, excludes)
tree = os.walk(path, False)
for root, subs, files in tree:
# keep only the Python script files
py_files = check_py_file(files)
# remove hidden ('.') and private ('_') directories
subs = [sub for sub in subs if sub[0] not in ['.', '_']]
# check if there's valid files to process
if "/." in root or "/_" in root \
or not py_files \
or check_excludes(root, excludes):
continue
subroot = root[len(path):].lstrip('/').replace('/', '.')
if root == path:
# we are at the root level so we create only modules
for py_file in py_files:
module = py_file[:-3]
create_module_file(root, module, opts)
toc.append(module)
elif not subs and "__init__.py" in py_files:
# we are in a package without sub package
create_package_file(root, subroot, py_files, opts=opts)
toc.append(subroot)
elif "__init__.py" in py_files:
# we are in package with subpackage(s)
create_package_file(root, subroot, py_files, opts, subs)
toc.append(subroot)
# create the module's index
if not opts.notoc:
modules_toc(toc, opts)
def modules_toc(modules, opts, name='modules'):
"""
Create the module's index.
"""
fname = create_file_name(name, opts)
if not opts.force and os.path.exists(fname):
print "File %s already exists." % name
return
print "Creating module's index modules.txt."
text = write_heading(opts.header, 'Modules')
text += title_line('Modules:', '-')
text += '.. toctree::\n'
text += ' :maxdepth: %s\n\n' % opts.maxdepth
modules.sort()
prev_module = ''
for module in modules:
# look if the module is a subpackage and, if yes, ignore it
if module.startswith(prev_module + '.'):
continue
prev_module = module
text += ' %s\n' % module
# write the file
if not opts.dryrun:
fd = open(fname, 'w')
fd.write(text)
fd.close()
def format_excludes(path, excludes):
"""
Format the excluded directory list.
(verify that the path is not from the root of the volume or the root of the
package)
"""
f_excludes = []
for exclude in excludes:
if exclude[0] != '/' and exclude[:len(path)] != path:
exclude = '%s/%s' % (path, exclude)
# remove trailing slash
f_excludes.append(exclude.rstrip('/'))
return f_excludes
def check_excludes(root, excludes):
"""
Check if the directory is in the exclude list.
"""
for exclude in excludes:
if root[:len(exclude)] == exclude:
return True
return False
def check_py_file(files):
"""
Return a list with only the python scripts (remove all other files).
"""
py_files = [fich for fich in files if fich[-3:] == '.py']
return py_files
if __name__ == '__main__':
parser = optparse.OptionParser(usage="""usage: %prog [options] <package path> [exclude paths, ...]
Note: By default this script will not overwrite already created files.""")
parser.add_option("-n", "--doc-header", action="store", dest="header", help="Documentation Header (default=Project)", default="Project")
parser.add_option("-d", "--dest-dir", action="store", dest="destdir", help="Output destination directory", default="")
parser.add_option("-s", "--suffix", action="store", dest="suffix", help="module suffix (default=txt)", default="txt")
parser.add_option("-m", "--maxdepth", action="store", dest="maxdepth", help="Maximum depth of submodules to show in the TOC (default=4)", type="int", default=4)
parser.add_option("-r", "--dry-run", action="store_true", dest="dryrun", help="Run the script without creating the files")
parser.add_option("-f", "--force", action="store_true", dest="force", help="Overwrite all the files")
parser.add_option("-t", "--no-toc", action="store_true", dest="notoc", help="Don't create the table of content file")
(opts, args) = parser.parse_args()
if len(args) < 1:
parser.error("package path is required.")
else:
if os.path.isdir(args[0]):
# if there's some exclude arguments, build the list of excludes
excludes = args[1:]
recurse_tree(args[0], excludes, opts)
else:
print '%s is not a valid directory.' % args
| ajibawa-2023/Python-Code-Large/train/row_752 | 143 | 258 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L22_C0", "label": "expression", "type": "expression", "loc": [22, 26], "level": 0, "parent": null, "vector": [8, 0, 0.093, 0.0194, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis script parse a directory tree looking for python modules and packages and\ncreate ReST files appropriately to create code documentation with Sphinx.\nIt also create a modules index. \n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Import_L28_C0", "label": "os import os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1085, 0.0039, 0, 0.66, 0.0588, 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_752:Import_L29_C0", "label": "optparse import optparse", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1124, 0.0039, 0, 0.66, 0.1176, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L33_C0", "label": "options =", "type": "assigned_variable", "loc": [33, 36], "level": 0, "parent": null, "vector": [14, 0, 0.1337, 0.0155, 0, 0.66, 0.1765, 707, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options = ['members',\n 'undoc-members',\n# 'inherited-members', # disable because there's a bug in sphinx\n 'show-inheritance']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "label": "create_file_name", "type": "function", "loc": [38, 40], "level": 0, "parent": null, "vector": [2, 0, 0.1512, 0.0116, 0, 0.66, 0.2353, 96, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "create_file_name", "arg_names": ["base", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_file_name(base, opts):\n \"\"\"Create file name from base name, path and suffix\"\"\"\n return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "vector": [8, 1, 0.1512, 0.0039, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create file name from base name, path and suffix\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "vector": [13, 1, 0.155, 0.0039, 1, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.path.join(opts.destdir, \"%s.%s\" % (base, opts.suffix))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "label": "write_directive", "type": "function", "loc": [42, 47], "level": 0, "parent": null, "vector": [2, 0, 0.1725, 0.0233, 0, 0.66, 0.2941, 996, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "write_directive", "arg_names": ["module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_directive(module):\n \"\"\"Create the automodule directive and add the options\"\"\"\n directive = '.. automodule:: %s\\n' % module\n for option in options:\n directive += ' :%s:\\n' % option\n return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "vector": [8, 1, 0.1667, 0.0039, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the automodule directive and add the options\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L44_C4", "label": "directive =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "vector": [14, 1, 0.1705, 0.0039, 1, 0.09, 0.3333, 677, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "directive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " directive = '.. automodule:: %s\\n' % module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L45_C4", "label": "for option", "type": "for", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "vector": [6, 1, 0.1764, 0.0078, 1, 0.09, 0.6667, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for option in options:\n directive += ' :%s:\\n' % option"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "vector": [13, 1, 0.1822, 0.0039, 1, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "label": "write_heading", "type": "function", "loc": [49, 54], "level": 0, "parent": null, "vector": [2, 0, 0.1996, 0.0233, 0, 0.66, 0.3529, 573, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "write_heading", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_heading(module, kind='Module'):\n \"\"\"Create the page heading.\"\"\"\n module = module.title()\n heading = title_line(module + ' Documentation', '=')\n heading += 'This page contains the %s %s documentation.\\n\\n' % (module, kind)\n return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "vector": [8, 1, 0.1938, 0.0039, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the page heading.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L51_C4", "label": "module = title()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "vector": [14, 1, 0.1977, 0.0039, 1, 0.6, 0.3333, 98, 3, 0, 0, 0, 48, 10, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " module = module.title()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L52_C4", "label": "heading = title_line()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "vector": [14, 1, 0.2016, 0.0039, 1, 0.6, 0.6667, 841, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "heading", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " heading = title_line(module + ' Documentation', '=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L54_C4", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "vector": [13, 1, 0.2093, 0.0039, 1, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return heading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "label": "write_sub", "type": "function", "loc": [56, 59], "level": 0, "parent": null, "vector": [2, 0, 0.2229, 0.0155, 0, 0.66, 0.4118, 320, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "write_sub", "arg_names": ["module", "kind"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_sub(module, kind='Module'):\n \"\"\"Create the module subtitle\"\"\"\n sub = title_line('The :mod:`%s` %s' % (module, kind), '-')\n return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "vector": [8, 1, 0.2209, 0.0039, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create the module subtitle\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L58_C4", "label": "sub = title_line()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "vector": [14, 1, 0.2248, 0.0039, 1, 0.45, 0.5, 819, 3, 2, 0, 0, 810, 10, 1], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "title_line", "annotation": ""}, "snippet": " sub = title_line('The :mod:`%s` %s' % (module, kind), '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "vector": [13, 1, 0.2287, 0.0039, 1, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L61_C0", "label": "title_line", "type": "function", "loc": [61, 63], "level": 0, "parent": null, "vector": [2, 0, 0.2403, 0.0116, 0, 0.66, 0.4706, 810, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "title_line", "arg_names": ["title", "char"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def title_line(title, char):\n \"\"\" Underline the title with the character pass, with the right length.\"\"\"\n return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L61_C0", "vector": [8, 1, 0.2403, 0.0039, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Underline the title with the character pass, with the right length.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L61_C0", "vector": [13, 1, 0.2442, 0.0039, 1, 0.43, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s\\n%s\\n\\n' % (title, len(title) * char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "label": "create_module_file", "type": "function", "loc": [65, 80], "level": 0, "parent": null, "vector": [2, 0, 0.281, 0.062, 0, 0.66, 0.5294, 545, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "create_module_file", "arg_names": ["root", "module", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_module_file(root, module, opts):\n \"\"\"Build the text of the file and write the file.\"\"\"\n name = create_file_name(module, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L66_C4", "label": "expression", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "vector": [8, 1, 0.2558, 0.0039, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L67_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "vector": [14, 1, 0.2597, 0.0039, 1, 0.55, 0.5, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4", "label": "if", "type": "if", "loc": [68, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "vector": [4, 1, 0.2868, 0.0504, 1, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(module)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L69_C8", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4", "vector": [8, 2, 0.2674, 0.0039, 2, 0.91, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "label": "if", "type": "if", "loc": [70, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4", "vector": [4, 2, 0.2907, 0.0426, 2, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif check_for_code('%s/%s.py' % (root, module)): # don't build the file if there's no code in it\n print('Creating file %s for module.' % name)\n text = write_heading(module)\n text += write_sub(module)\n text += write_directive(module)\n\n # write the file\n if not opts.dryrun: "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L71_C8", "label": "print()", "type": "expression", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "vector": [8, 3, 0.2752, 0.0039, 3, 0.75, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for module.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L72_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "vector": [14, 3, 0.2791, 0.0039, 3, 0.75, 0.5, 439, 3, 1, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "label": "if", "type": "if", "loc": [77, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "vector": [4, 3, 0.3043, 0.0155, 3, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L78_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "vector": [14, 4, 0.3023, 0.0039, 4, 0.03, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L79_C12", "label": "write()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "vector": [8, 4, 0.3062, 0.0039, 4, 0.03, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L80_C12", "label": "close()", "type": "expression", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "vector": [8, 4, 0.3101, 0.0039, 4, 0.03, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "label": "create_package_file", "type": "function", "loc": [82, 122], "level": 0, "parent": null, "vector": [2, 0, 0.3953, 0.1589, 0, 0.66, 0.5882, 711, 0, 5, 0, 0, 0, 0, 15], "semantic": {"name": "create_package_file", "arg_names": ["root", "subroot", "py_files", "opts", "subs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_package_file(root, subroot, py_files, opts, subs=None):\n \"\"\"Build the text of the file and write the file.\"\"\"\n package = root.rpartition('/')[2].lower()\n name = create_file_name(subroot, opts)\n if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L83_C4", "label": "expression", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "vector": [8, 1, 0.3217, 0.0039, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the text of the file and write the file.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L84_C4", "label": "package = lower()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "vector": [14, 1, 0.3256, 0.0039, 1, 0.04, 0.3333, 187, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "package", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " package = root.rpartition('/')[2].lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L85_C4", "label": "name = create_file_name()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "vector": [14, 1, 0.3295, 0.0039, 1, 0.04, 0.6667, 57, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " name = create_file_name(subroot, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "label": "if", "type": "if", "loc": [86, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "vector": [4, 1, 0.4031, 0.1434, 1, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.isfile(name):\n print('File %s already exists.' % name)\n else:\n print('Creating file %s for package.' % name)\n text = write_heading(package, 'Package')\n if subs == None:\n subs = []\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L87_C8", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [8, 2, 0.3372, 0.0039, 2, 0.13, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('File %s already exists.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L89_C8", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [8, 2, 0.345, 0.0039, 2, 0.13, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating file %s for package.' % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L90_C8", "label": "text = write_heading()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [14, 2, 0.3488, 0.0039, 2, 0.13, 0.4, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(package, 'Package')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "label": "if", "type": "if", "loc": [91, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [4, 2, 0.374, 0.0465, 2, 0.13, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs == None:\n subs = []\n else:\n # build a list of directories that are package (they contain an __init_.py file)\n subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]\n # if there's some package directories, add a TOC for theses subpackages\n if subs:\n text += title_line('Subpackages', '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L92_C12", "label": "subs =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "vector": [14, 3, 0.3566, 0.0039, 3, 0.15, 0.0, 603, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L95_C12", "label": "subs =", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "vector": [14, 3, 0.3682, 0.0039, 3, 0.15, 0.5, 603, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if os.path.isfile('%s/%s/__init__.py' % (root, sub))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L97_C12", "label": "if", "type": "if", "loc": [97, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "vector": [4, 3, 0.3857, 0.0233, 3, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if subs:\n text += title_line('Subpackages', '-')\n text += '.. toctree::\\n\\n'\n for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)\n text += '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L100_C16", "label": "for sub", "type": "for", "loc": [100, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L97_C12", "vector": [6, 4, 0.3895, 0.0078, 4, 0.33, 0.0, 819, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sub", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for sub in subs:\n text += ' %s.%s\\n' % (subroot, sub)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "label": "for py_file", "type": "for", "loc": [105, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [6, 2, 0.4283, 0.0465, 2, 0.13, 0.8, 44, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue\n py_file = py_file[:-3]\n py_path = '%s.%s' % (subroot, py_file)\n kind = \"Module\"\n if py_file == '__init__':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L106_C12", "label": "if", "type": "if", "loc": [106, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "vector": [4, 3, 0.4147, 0.0116, 3, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not check_for_code('%s/%s' % (root, py_file)):\n # don't build the file if there's no code in it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L109_C12", "label": "py_file =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "vector": [14, 3, 0.4225, 0.0039, 3, 0.38, 0.25, 44, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_file = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L110_C12", "label": "py_path =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "vector": [14, 3, 0.4264, 0.0039, 3, 0.38, 0.5, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_path = '%s.%s' % (subroot, py_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L111_C12", "label": "kind =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "vector": [14, 3, 0.4302, 0.0039, 3, 0.38, 0.75, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Module\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L112_C12", "label": "if", "type": "if", "loc": [112, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "vector": [4, 3, 0.436, 0.0078, 3, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if py_file == '__init__':\n kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L113_C16", "label": "kind =", "type": "assigned_variable", "loc": [113, 113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L112_C12", "vector": [14, 4, 0.438, 0.0039, 4, 0.15, 0.0, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kind = \"Package\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "label": "if", "type": "if", "loc": [119, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "vector": [4, 2, 0.4671, 0.0155, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(name, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L120_C12", "label": "fd = open()", "type": "assigned_variable", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "vector": [14, 3, 0.4651, 0.0039, 3, 0.33, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(name, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L121_C12", "label": "write()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "vector": [8, 3, 0.469, 0.0039, 3, 0.33, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L122_C12", "label": "close()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "vector": [8, 3, 0.4729, 0.0039, 3, 0.33, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "label": "check_for_code", "type": "function", "loc": [124, 134], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.0426, 0, 0.66, 0.6471, 62, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "check_for_code", "arg_names": ["module"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_for_code(module):\n \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\"\n fd = open(module, 'r')\n for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L125_C4", "label": "expression", "type": "expression", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "vector": [8, 1, 0.4884, 0.0116, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if there's at least one class or one function in the module.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L128_C4", "label": "fd = open()", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "vector": [14, 1, 0.4961, 0.0039, 1, 0.43, 0.25, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(module, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L129_C4", "label": "for line", "type": "for", "loc": [129, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "vector": [6, 1, 0.5058, 0.0155, 1, 0.43, 0.5, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in fd:\n if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8", "label": "if", "type": "if", "loc": [130, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L129_C4", "vector": [4, 2, 0.5078, 0.0116, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('def ') or line.startswith('class '):\n fd.close()\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L131_C12", "label": "close()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8", "vector": [8, 3, 0.5078, 0.0039, 3, 0.25, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L132_C12", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8", "vector": [13, 3, 0.5116, 0.0039, 3, 0.25, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L133_C4", "label": "close()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "vector": [8, 1, 0.5155, 0.0039, 1, 0.43, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L134_C4", "label": "return", "type": "return", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "vector": [13, 1, 0.5194, 0.0039, 1, 0.43, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "label": "recurse_tree", "type": "function", "loc": [136, 172], "level": 0, "parent": null, "vector": [2, 0, 0.5969, 0.1434, 0, 0.66, 0.7059, 12, 0, 3, 0, 0, 0, 0, 14], "semantic": {"name": "recurse_tree", "arg_names": ["path", "excludes", "opts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def recurse_tree(path, excludes, opts):\n \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\"\n toc = []\n excludes = format_excludes(path, excludes)\n tree = os.walk(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L137_C4", "label": "expression", "type": "expression", "loc": [137, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [8, 1, 0.5368, 0.0155, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Look for every file in the directory tree and create the corresponding\n ReST files.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L141_C4", "label": "toc =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [14, 1, 0.5465, 0.0039, 1, 0.22, 0.2, 360, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "toc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toc = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L142_C4", "label": "excludes = format_excludes()", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [14, 1, 0.5504, 0.0039, 1, 0.22, 0.4, 626, 3, 2, 0, 0, 740, 10, 1], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "format_excludes", "annotation": ""}, "snippet": " excludes = format_excludes(path, excludes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L143_C4", "label": "tree = walk()", "type": "assigned_variable", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [14, 1, 0.5543, 0.0039, 1, 0.22, 0.6, 613, 3, 2, 0, 0, 511, 10, 1], "semantic": {"name": "tree", "arg_names": [], "import_names": [], "rhs_call_name": "walk", "annotation": ""}, "snippet": " tree = os.walk(path, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "label": "for root, subs, files", "type": "for", "loc": [144, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [6, 1, 0.6047, 0.0969, 1, 0.22, 0.8, 230, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "root, subs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, subs, files in tree:\n # keep only the Python script files\n py_files = check_py_file(files)\n # remove hidden ('.') and private ('_') directories\n subs = [sub for sub in subs if sub[0] not in ['.', '_']]\n # check if there's valid files to process\n if \"/.\" in root or \"/_\" in root \\\n or not py_files \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L146_C8", "label": "py_files = check_py_file()", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "vector": [14, 2, 0.5659, 0.0039, 2, 0.95, 0.0, 318, 3, 1, 0, 0, 422, 10, 1], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "check_py_file", "annotation": ""}, "snippet": " py_files = check_py_file(files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L148_C8", "label": "subs =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "vector": [14, 2, 0.5736, 0.0039, 2, 0.95, 0.25, 603, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "subs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subs = [sub for sub in subs if sub[0] not in ['.', '_']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L150_C8", "label": "if", "type": "if", "loc": [150, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "vector": [4, 2, 0.5872, 0.0155, 2, 0.95, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"/.\" in root or \"/_\" in root \\\n or not py_files \\\n or check_excludes(root, excludes):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L154_C8", "label": "subroot = replace()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "vector": [14, 2, 0.5969, 0.0039, 2, 0.95, 0.75, 530, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "subroot", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " subroot = root[len(path):].lstrip('/').replace('/', '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8", "label": "if", "type": "if", "loc": [155, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "vector": [4, 2, 0.626, 0.0543, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root == path:\n # we are at the root level so we create only modules\n for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, module, opts)\n toc.append(module)\n elif not subs and \"__init__.py\" in py_files:\n # we are in a package without sub package"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "label": "for py_file", "type": "for", "loc": [157, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8", "vector": [6, 3, 0.6143, 0.0155, 3, 0.27, 0.0, 44, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "py_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for py_file in py_files:\n module = py_file[:-3]\n create_module_file(root, module, opts)\n toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L158_C16", "label": "module =", "type": "assigned_variable", "loc": [158, 158], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "vector": [14, 4, 0.6124, 0.0039, 4, 0.04, 0.0, 98, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " module = py_file[:-3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L159_C16", "label": "create_module_file()", "type": "expression", "loc": [159, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "vector": [8, 4, 0.6163, 0.0039, 4, 0.04, 0.5, 545, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_module_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_module_file", "annotation": ""}, "snippet": " create_module_file(root, module, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L160_C16", "label": "append()", "type": "expression", "loc": [160, 160], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "vector": [8, 4, 0.6202, 0.0039, 4, 0.04, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(module)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "label": "if", "type": "if", "loc": [161, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8", "vector": [4, 3, 0.6376, 0.031, 3, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not subs and \"__init__.py\" in py_files:\n # we are in a package without sub package\n create_package_file(root, subroot, py_files, opts=opts)\n toc.append(subroot)\n elif \"__init__.py\" in py_files:\n # we are in package with subpackage(s)\n create_package_file(root, subroot, py_files, opts, subs)\n toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L163_C12", "label": "create_package_file()", "type": "expression", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "vector": [8, 4, 0.6318, 0.0039, 4, 0.67, 0.0, 711, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts=opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L164_C12", "label": "append()", "type": "expression", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "vector": [8, 4, 0.6357, 0.0039, 4, 0.67, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8", "label": "if", "type": "if", "loc": [165, 168], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "vector": [4, 4, 0.6453, 0.0155, 4, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif \"__init__.py\" in py_files:\n # we are in package with subpackage(s)\n create_package_file(root, subroot, py_files, opts, subs)\n toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L167_C12", "label": "create_package_file()", "type": "expression", "loc": [167, 167], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8", "vector": [8, 5, 0.6473, 0.0039, 5, 0.65, 0.0, 711, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_package_file", "arg_names": [], "import_names": [], "rhs_call_name": "create_package_file", "annotation": ""}, "snippet": " create_package_file(root, subroot, py_files, opts, subs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L168_C12", "label": "append()", "type": "expression", "loc": [168, 168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8", "vector": [8, 5, 0.6512, 0.0039, 5, 0.65, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " toc.append(subroot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L171_C4", "label": "if", "type": "if", "loc": [171, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "vector": [4, 1, 0.6647, 0.0078, 1, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.notoc:\n modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L172_C8", "label": "modules_toc()", "type": "expression", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L171_C4", "vector": [8, 2, 0.6667, 0.0039, 2, 0.39, 0.0, 334, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "modules_toc", "arg_names": [], "import_names": [], "rhs_call_name": "modules_toc", "annotation": ""}, "snippet": " modules_toc(toc, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "label": "modules_toc", "type": "function", "loc": [174, 202], "level": 0, "parent": null, "vector": [2, 0, 0.7287, 0.1124, 0, 0.66, 0.7647, 334, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "modules_toc", "arg_names": ["modules", "opts", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modules_toc(modules, opts, name='modules'):\n \"\"\"\n Create the module's index.\n \"\"\"\n fname = create_file_name(name, opts) \n if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L175_C4", "label": "expression", "type": "expression", "loc": [175, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [8, 1, 0.6822, 0.0116, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Create the module's index.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L178_C4", "label": "fname = create_file_name()", "type": "assigned_variable", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [14, 1, 0.6899, 0.0039, 1, 0.75, 0.125, 190, 3, 2, 0, 0, 96, 10, 1], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "create_file_name", "annotation": ""}, "snippet": " fname = create_file_name(name, opts) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4", "label": "if", "type": "if", "loc": [179, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [4, 1, 0.6977, 0.0116, 1, 0.75, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.force and os.path.exists(fname):\n print(\"File %s already exists.\" % name)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L180_C8", "label": "print()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4", "vector": [8, 2, 0.6977, 0.0039, 2, 0.29, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"File %s already exists.\" % name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L181_C8", "label": "return", "type": "return", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4", "vector": [13, 2, 0.7016, 0.0039, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L183_C4", "label": "print()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [8, 1, 0.7093, 0.0039, 1, 0.75, 0.375, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Creating module's index modules.txt.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L184_C4", "label": "text = write_heading()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [14, 1, 0.7132, 0.0039, 1, 0.75, 0.5, 439, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "write_heading", "annotation": ""}, "snippet": " text = write_heading(opts.header, 'Modules')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L189_C4", "label": "sort()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [8, 1, 0.7326, 0.0039, 1, 0.75, 0.625, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " modules.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L190_C4", "label": "prev_module =", "type": "assigned_variable", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [14, 1, 0.7364, 0.0039, 1, 0.75, 0.75, 444, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4", "label": "for module", "type": "for", "loc": [191, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [6, 1, 0.75, 0.0233, 1, 0.75, 0.875, 98, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for module in modules:\n # look if the module is a subpackage and, if yes, ignore it\n if module.startswith(prev_module + '.'):\n continue\n prev_module = module\n text += ' %s\\n' % module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L193_C8", "label": "if", "type": "if", "loc": [193, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4", "vector": [4, 2, 0.75, 0.0078, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if module.startswith(prev_module + '.'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L195_C8", "label": "prev_module =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4", "vector": [14, 2, 0.7558, 0.0039, 2, 0.55, 1.0, 444, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_module = module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "label": "if", "type": "if", "loc": [199, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "vector": [4, 1, 0.7771, 0.0155, 1, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not opts.dryrun: \n fd = open(fname, 'w')\n fd.write(text)\n fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L200_C8", "label": "fd = open()", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "vector": [14, 2, 0.7752, 0.0039, 2, 0.68, 0.0, 863, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fd = open(fname, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L201_C8", "label": "write()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "vector": [8, 2, 0.7791, 0.0039, 2, 0.68, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fd.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L202_C8", "label": "close()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "vector": [8, 2, 0.7829, 0.0039, 2, 0.68, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fd.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "label": "format_excludes", "type": "function", "loc": [204, 216], "level": 0, "parent": null, "vector": [2, 0, 0.814, 0.0504, 0, 0.66, 0.8235, 740, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "format_excludes", "arg_names": ["path", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def format_excludes(path, excludes):\n \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\"\n f_excludes = []\n for exclude in excludes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L205_C4", "label": "expression", "type": "expression", "loc": [205, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "vector": [8, 1, 0.8023, 0.0194, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Format the excluded directory list.\n (verify that the path is not from the root of the volume or the root of the\n package)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L210_C4", "label": "f_excludes =", "type": "assigned_variable", "loc": [210, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "vector": [14, 1, 0.814, 0.0039, 1, 0.25, 0.3333, 109, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f_excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f_excludes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4", "label": "for exclude", "type": "for", "loc": [211, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "vector": [6, 1, 0.8256, 0.0194, 1, 0.25, 0.6667, 739, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)\n # remove trailing slash\n f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L212_C8", "label": "if", "type": "if", "loc": [212, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4", "vector": [4, 2, 0.8236, 0.0078, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exclude[0] != '/' and exclude[:len(path)] != path:\n exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L213_C12", "label": "exclude =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L212_C8", "vector": [14, 3, 0.8256, 0.0039, 3, 0.12, 0.0, 739, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exclude = '%s/%s' % (path, exclude)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L215_C8", "label": "append()", "type": "expression", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4", "vector": [8, 2, 0.8333, 0.0039, 2, 0.6, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " f_excludes.append(exclude.rstrip('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L216_C4", "label": "return", "type": "return", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "vector": [13, 1, 0.8372, 0.0039, 1, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f_excludes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "label": "check_excludes", "type": "function", "loc": [218, 225], "level": 0, "parent": null, "vector": [2, 0, 0.8585, 0.031, 0, 0.66, 0.8824, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "check_excludes", "arg_names": ["root", "excludes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_excludes(root, excludes):\n \"\"\"\n Check if the directory is in the exclude list.\n \"\"\"\n for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L219_C4", "label": "expression", "type": "expression", "loc": [219, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "vector": [8, 1, 0.8527, 0.0116, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check if the directory is in the exclude list.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:For_L222_C4", "label": "for exclude", "type": "for", "loc": [222, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "vector": [6, 1, 0.8643, 0.0116, 1, 0.36, 0.5, 739, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exclude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for exclude in excludes:\n if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L223_C8", "label": "if", "type": "if", "loc": [223, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:For_L222_C4", "vector": [4, 2, 0.8663, 0.0078, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root[:len(exclude)] == exclude:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L224_C12", "label": "return", "type": "return", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L223_C8", "vector": [13, 3, 0.8682, 0.0039, 3, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L225_C4", "label": "return", "type": "return", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "vector": [13, 1, 0.8721, 0.0039, 1, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "label": "check_py_file", "type": "function", "loc": [227, 232], "level": 0, "parent": null, "vector": [2, 0, 0.8895, 0.0233, 0, 0.66, 0.9412, 422, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "check_py_file", "arg_names": ["files"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_py_file(files):\n \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\"\n py_files = [fich for fich in files if fich[-3:] == '.py']\n return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L228_C4", "label": "expression", "type": "expression", "loc": [228, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "vector": [8, 1, 0.8876, 0.0116, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return a list with only the python scripts (remove all other files). \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L231_C4", "label": "py_files =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "vector": [14, 1, 0.8953, 0.0039, 1, 0.96, 0.5, 318, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "py_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " py_files = [fich for fich in files if fich[-3:] == '.py']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L232_C4", "label": "return", "type": "return", "loc": [232, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "vector": [13, 1, 0.8992, 0.0039, 1, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return py_files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "label": "if", "type": "if", "loc": [235, 256], "level": 0, "parent": null, "vector": [4, 0, 0.9516, 0.0853, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n\n parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")\n parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")\n parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")\n parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L237_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [237, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [14, 1, 0.9225, 0.0116, 1, 0.51, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage=\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n \nNote: By default this script will not overwrite already created files.\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L240_C4", "label": "add_option()", "type": "expression", "loc": [240, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9302, 0.0039, 1, 0.51, 0.1111, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-n\", \"--doc-header\", action=\"store\", dest=\"header\", help=\"Documentation Header (default=Project)\", default=\"Project\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L241_C4", "label": "add_option()", "type": "expression", "loc": [241, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9341, 0.0039, 1, 0.51, 0.2222, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-d\", \"--dest-dir\", action=\"store\", dest=\"destdir\", help=\"Output destination directory\", default=\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L242_C4", "label": "add_option()", "type": "expression", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.938, 0.0039, 1, 0.51, 0.3333, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-s\", \"--suffix\", action=\"store\", dest=\"suffix\", help=\"module suffix (default=txt)\", default=\"txt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L243_C4", "label": "add_option()", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9419, 0.0039, 1, 0.51, 0.4444, 176, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-m\", \"--maxdepth\", action=\"store\", dest=\"maxdepth\", help=\"Maximum depth of submodules to show in the TOC (default=4)\", type=\"int\", default=4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L244_C4", "label": "add_option()", "type": "expression", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9457, 0.0039, 1, 0.51, 0.5556, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-r\", \"--dry-run\", action=\"store_true\", dest=\"dryrun\", help=\"Run the script without creating the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L245_C4", "label": "add_option()", "type": "expression", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9496, 0.0039, 1, 0.51, 0.6667, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-f\", \"--force\", action=\"store_true\", dest=\"force\", help=\"Overwrite all the files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L246_C4", "label": "add_option()", "type": "expression", "loc": [246, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [8, 1, 0.9535, 0.0039, 1, 0.51, 0.7778, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option(\"-t\", \"--no-toc\", action=\"store_true\", dest=\"notoc\", help=\"Don't create the table of content file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L247_C4", "label": "opts, args = parse_args()", "type": "assigned_variable", "loc": [247, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [14, 1, 0.9574, 0.0039, 1, 0.51, 0.8889, 616, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (opts, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4", "label": "if", "type": "if", "loc": [248, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "vector": [4, 1, 0.9767, 0.0349, 1, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) < 1:\n parser.error(\"package path is required.\")\n else:\n if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L249_C8", "label": "error()", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4", "vector": [8, 2, 0.9651, 0.0039, 2, 0.17, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"package path is required.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "label": "if", "type": "if", "loc": [251, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4", "vector": [4, 2, 0.9826, 0.0233, 2, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(args[0]):\n # if there's some exclude arguments, build the list of excludes\n excludes = args[1:]\n recurse_tree(args[0], excludes, opts)\n else:\n print('%s is not a valid directory.' % args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L253_C12", "label": "excludes =", "type": "assigned_variable", "loc": [253, 253], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "vector": [14, 3, 0.9806, 0.0039, 3, 0.15, 0.0, 626, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "excludes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " excludes = args[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L254_C12", "label": "recurse_tree()", "type": "expression", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "vector": [8, 3, 0.9845, 0.0039, 3, 0.15, 0.5, 12, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "recurse_tree", "arg_names": [], "import_names": [], "rhs_call_name": "recurse_tree", "annotation": ""}, "snippet": " recurse_tree(args[0], excludes, opts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L256_C12", "label": "print()", "type": "expression", "loc": [256, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "vector": [8, 3, 0.9922, 0.0039, 3, 0.15, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is not a valid directory.' % args)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L112_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L113_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L159_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L167_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:For_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:For_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:FunctionDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Return_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L235_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Assign_L253_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_752:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_752:Expr_L256_C12"}] |
import os
import subprocess
import codecs
#--- BZR: changelog information
def write_changelog_bzr(repo_path, output_dir,
output_file='bzr_revision_log.txt',
target_encoding='utf-8'):
"""Write the bzr changelog to a file which can then be included in the documentation
"""
bzr_logfile_path = os.path.join(output_dir, output_file)
bzr_logfile = codecs.open(bzr_logfile_path, 'w', encoding=target_encoding)
try:
p_log = subprocess.Popen(('bzr log --short'),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
(stdout, stderr) = p_log.communicate()
bzr_logfile.write(stdout)
finally:
bzr_logfile.close()
#UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 2871: ordinal not in range(128)
# like bzr version-info --format python > vers_test.py
#--- BZR: version info
def write_version_info_bzr(repo_path, output_dir, output_file='_version.py'):
"""Write the version information from BZR repository into a version file.
Parameters
----------
repo_path : string
Path to the BZR repository root
repo_path : string
Path to the output directory where the version info is saved
detail, e.g. ``(N,) ndarray`` or ``array_like``.
output_file : string
output file name
Returns
-------
p_info : subprocess_obj
contents of the `func:`suprocess.Popen` returns
"""
bzr_version_filepath = os.path.join(output_dir, output_file)
bzr_version_file = open(bzr_version_filepath, 'w')
p_info = subprocess.Popen(('bzr version-info --format python'),
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
(stdout, stderr) = p_info.communicate()
bzr_version_file.write(stdout)
bzr_version_file.close()
return p_info
#--- auto generate documentation
def autogenerate_package_doc(script_path, dest_dir,
package_dir,
doc_header,
suffix='rst',
overwrite=False):
"""Autogenerate package API ReSt documents
"""
print script_path
if overwrite:
force = '--force'
p_apidoc = subprocess.Popen(('python', script_path,
'--dest-dir='+dest_dir,
'--suffix='+suffix,
'--doc-header='+doc_header,
force,
package_dir), bufsize=-1)
'sphinxext\local\generate_modules_modif.py --dest-dir=source\contents\lib\auxilary\generated --suffix=rst --force --doc-header=Auxilary ..\..\modules_local\auxilary'
return p_apidoc
if __name__ == "__main__":
repo_path = os.path.join('..', '.')
output_dir = os.path.join('.')
write_changelog_bzr(repo_path, output_dir, output_file='changelog.txt')
| ajibawa-2023/Python-Code-Large/train/row_753 | 33 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_753:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0115, 0.0115, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Import_L2_C0", "label": "subprocess import subprocess", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.023, 0.0115, 0, 0.66, 0.1667, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Import_L3_C0", "label": "codecs import codecs", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0115, 0, 0.66, 0.3333, 220, 0, 1, 0, 0, 220, 0, 0], "semantic": {"name": "codecs", "arg_names": [], "import_names": ["codecs"], "rhs_call_name": "", "annotation": ""}, "snippet": "import codecs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "label": "write_changelog_bzr", "type": "function", "loc": [7, 21], "level": 0, "parent": null, "vector": [2, 0, 0.1609, 0.1724, 0, 0.66, 0.5, 298, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "write_changelog_bzr", "arg_names": ["repo_path", "output_dir", "output_file", "target_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_changelog_bzr(repo_path, output_dir, \n output_file='bzr_revision_log.txt', \n target_encoding='utf-8'):\n \"\"\"Write the bzr changelog to a file which can then be included in the documentation\n \"\"\"\n\n bzr_logfile_path = os.path.join(output_dir, output_file)\n bzr_logfile = codecs.open(bzr_logfile_path, 'w', encoding=target_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "vector": [8, 1, 0.1207, 0.023, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Write the bzr changelog to a file which can then be included in the documentation\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L13_C4", "label": "bzr_logfile_path = join()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "vector": [14, 1, 0.1494, 0.0115, 1, 0.3, 0.3333, 610, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "bzr_logfile_path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " bzr_logfile_path = os.path.join(output_dir, output_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L14_C4", "label": "bzr_logfile = open()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "vector": [14, 1, 0.1609, 0.0115, 1, 0.3, 0.6667, 361, 3, 3, 0, 0, 693, 10, 1], "semantic": {"name": "bzr_logfile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " bzr_logfile = codecs.open(bzr_logfile_path, 'w', encoding=target_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "label": "try", "type": "try", "loc": [15, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "vector": [7, 1, 0.2069, 0.0805, 1, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n p_log = subprocess.Popen(('bzr log --short'), \n stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)\n (stdout, stderr) = p_log.communicate()\n bzr_logfile.write(stdout)\n finally:\n bzr_logfile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L16_C8", "label": "p_log = Popen()", "type": "assigned_variable", "loc": [16, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "vector": [14, 2, 0.1897, 0.023, 2, 0.97, 0.0, 208, 3, 4, 0, 0, 568, 10, 1], "semantic": {"name": "p_log", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " p_log = subprocess.Popen(('bzr log --short'), \n stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L18_C8", "label": "stdout, stderr = communicate()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "vector": [14, 2, 0.2069, 0.0115, 2, 0.97, 0.3333, 616, 3, 0, 0, 0, 768, 10, 1], "semantic": {"name": "stdout, stderr", "arg_names": [], "import_names": [], "rhs_call_name": "communicate", "annotation": ""}, "snippet": " (stdout, stderr) = p_log.communicate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L19_C8", "label": "write()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "vector": [8, 2, 0.2184, 0.0115, 2, 0.97, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bzr_logfile.write(stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L21_C8", "label": "close()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "vector": [8, 2, 0.2414, 0.0115, 2, 0.97, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bzr_logfile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "label": "write_version_info_bzr", "type": "function", "loc": [30, 57], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.3218, 0, 0.66, 0.6667, 287, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "write_version_info_bzr", "arg_names": ["repo_path", "output_dir", "output_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_version_info_bzr(repo_path, output_dir, output_file='_version.py'):\n \"\"\"Write the version information from BZR repository into a version file.\n \n Parameters\n ----------\n repo_path : string\n Path to the BZR repository root\n repo_path : string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [8, 1, 0.454, 0.2069, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Write the version information from BZR repository into a version file.\n \n Parameters\n ----------\n repo_path : string\n Path to the BZR repository root\n repo_path : string\n Path to the output directory where the version info is saved"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L49_C4", "label": "bzr_version_filepath = join()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [14, 1, 0.5632, 0.0115, 1, 0.07, 0.1429, 726, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "bzr_version_filepath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " bzr_version_filepath = os.path.join(output_dir, output_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L50_C4", "label": "bzr_version_file = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [14, 1, 0.5747, 0.0115, 1, 0.07, 0.2857, 816, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "bzr_version_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " bzr_version_file = open(bzr_version_filepath, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L51_C4", "label": "p_info = Popen()", "type": "assigned_variable", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [14, 1, 0.592, 0.023, 1, 0.07, 0.4286, 945, 3, 4, 0, 0, 568, 10, 1], "semantic": {"name": "p_info", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " p_info = subprocess.Popen(('bzr version-info --format python'), \n stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L53_C4", "label": "stdout, stderr = communicate()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [14, 1, 0.6092, 0.0115, 1, 0.07, 0.5714, 616, 3, 0, 0, 0, 768, 10, 1], "semantic": {"name": "stdout, stderr", "arg_names": [], "import_names": [], "rhs_call_name": "communicate", "annotation": ""}, "snippet": " (stdout, stderr) = p_info.communicate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L54_C4", "label": "write()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [8, 1, 0.6207, 0.0115, 1, 0.07, 0.7143, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bzr_version_file.write(stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L55_C4", "label": "close()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [8, 1, 0.6322, 0.0115, 1, 0.07, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bzr_version_file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "vector": [13, 1, 0.6552, 0.0115, 1, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "label": "autogenerate_package_doc", "type": "function", "loc": [62, 81], "level": 0, "parent": null, "vector": [2, 0, 0.8218, 0.2299, 0, 0.66, 0.8333, 441, 0, 6, 1, 0, 0, 0, 2], "semantic": {"name": "autogenerate_package_doc", "arg_names": ["script_path", "dest_dir", "package_dir", "doc_header", "suffix", "overwrite"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def autogenerate_package_doc(script_path, dest_dir, \n package_dir, \n doc_header,\n suffix='rst',\n overwrite=False):\n \"\"\"Autogenerate package API ReSt documents\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [8, 1, 0.7816, 0.0345, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Autogenerate package API ReSt documents\n \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [8, 1, 0.8046, 0.0115, 1, 0.85, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(script_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [4, 1, 0.8218, 0.023, 1, 0.85, 0.4, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if overwrite: \n force = '--force' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L72_C8", "label": "force =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:If_L71_C4", "vector": [14, 2, 0.8276, 0.0115, 2, 0.62, 0.0, 77, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "force", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " force = '--force' "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L73_C4", "label": "p_apidoc = Popen()", "type": "assigned_variable", "loc": [73, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [14, 1, 0.8678, 0.069, 1, 0.85, 0.6, 137, 3, 2, 0, 0, 568, 10, 1], "semantic": {"name": "p_apidoc", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " p_apidoc = subprocess.Popen(('python', script_path, \n '--dest-dir='+dest_dir, \n '--suffix='+suffix, \n '--doc-header='+doc_header,\n force, \n package_dir), bufsize=-1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [8, 1, 0.908, 0.0115, 1, 0.85, 0.8, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " 'sphinxext\\local\\generate_modules_modif.py --dest-dir=source\\contents\\lib\\auxilary\\generated --suffix=rst --force --doc-header=Auxilary ..\\..\\modules_local\\auxilary'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "vector": [13, 1, 0.931, 0.0115, 1, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return p_apidoc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "label": "if", "type": "if", "loc": [84, 87], "level": 0, "parent": null, "vector": [4, 0, 0.9828, 0.046, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n repo_path = os.path.join('..', '.')\n output_dir = os.path.join('.')\n write_changelog_bzr(repo_path, output_dir, output_file='changelog.txt')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L85_C4", "label": "repo_path = join()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "vector": [14, 1, 0.977, 0.0115, 1, 0.09, 0.0, 349, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "repo_path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " repo_path = os.path.join('..', '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L86_C4", "label": "output_dir = join()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "vector": [14, 1, 0.9885, 0.0115, 1, 0.09, 0.5, 577, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "output_dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " output_dir = os.path.join('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L87_C4", "label": "write_changelog_bzr()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "vector": [8, 1, 1.0, 0.0115, 1, 0.09, 1.0, 298, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "write_changelog_bzr", "arg_names": [], "import_names": [], "rhs_call_name": "write_changelog_bzr", "annotation": ""}, "snippet": " write_changelog_bzr(repo_path, output_dir, output_file='changelog.txt')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:Try_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_753:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_753:Expr_L87_C4"}] |
#
# A pair of directives for inserting content that will only appear in
# either html or latex.
#
from docutils.nodes import Body, Element
from docutils.writers.html4css1 import HTMLTranslator
try:
from sphinx.latexwriter import LaTeXTranslator
except ImportError:
from sphinx.writers.latex import LaTeXTranslator
import warnings
warnings.warn("The numpydoc.only_directives module is deprecated;"
"please use the only:: directive available in Sphinx >= 0.6",
DeprecationWarning, stacklevel=2)
from docutils.parsers.rst import directives
class html_only(Body, Element):
pass
class latex_only(Body, Element):
pass
def run(content, node_class, state, content_offset):
text = '\n'.join(content)
node = node_class(text)
state.nested_parse(content, content_offset, node)
return [node]
try:
from docutils.parsers.rst import Directive
except ImportError:
from docutils.parsers.rst.directives import _directives
def html_only_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return run(content, html_only, state, content_offset)
def latex_only_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return run(content, latex_only, state, content_offset)
for func in (html_only_directive, latex_only_directive):
func.content = 1
func.options = {}
func.arguments = None
_directives['htmlonly'] = html_only_directive
_directives['latexonly'] = latex_only_directive
else:
class OnlyDirective(Directive):
has_content = True
required_arguments = 0
optional_arguments = 0
final_argument_whitespace = True
option_spec = {}
def run(self):
self.assert_has_content()
return run(self.content, self.node_class,
self.state, self.content_offset)
class HtmlOnlyDirective(OnlyDirective):
node_class = html_only
class LatexOnlyDirective(OnlyDirective):
node_class = latex_only
directives.register_directive('htmlonly', HtmlOnlyDirective)
directives.register_directive('latexonly', LatexOnlyDirective)
def setup(app):
app.add_node(html_only)
app.add_node(latex_only)
# Add visit/depart methods to HTML-Translator:
def visit_perform(self, node):
pass
def depart_perform(self, node):
pass
def visit_ignore(self, node):
node.children = []
def depart_ignore(self, node):
node.children = []
HTMLTranslator.visit_html_only = visit_perform
HTMLTranslator.depart_html_only = depart_perform
HTMLTranslator.visit_latex_only = visit_ignore
HTMLTranslator.depart_latex_only = depart_ignore
LaTeXTranslator.visit_html_only = visit_ignore
LaTeXTranslator.depart_html_only = depart_ignore
LaTeXTranslator.visit_latex_only = visit_perform
LaTeXTranslator.depart_latex_only = depart_perform
| ajibawa-2023/Python-Code-Large/train/row_756 | 60 | 96 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L6_C0", "label": "from docutils.nodes import Body, Element", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0104, 0, 0.66, 0.0, 127, 0, 2, 0, 0, 127, 0, 0], "semantic": {"name": "docutils.nodes", "arg_names": [], "import_names": ["Body", "Element"], "rhs_call_name": "", "annotation": ""}, "snippet": "from docutils.nodes import Body, Element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L7_C0", "label": "from docutils.writers.html4css1 import HTMLTranslator", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0729, 0.0104, 0, 0.66, 0.125, 949, 0, 1, 0, 0, 949, 0, 0], "semantic": {"name": "docutils.writers.html4css1", "arg_names": [], "import_names": ["HTMLTranslator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from docutils.writers.html4css1 import HTMLTranslator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "label": "try", "type": "try", "loc": [8, 16], "level": 0, "parent": null, "vector": [7, 0, 0.125, 0.0938, 0, 0.66, 0.25, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from sphinx.latexwriter import LaTeXTranslator\nexcept ImportError:\n from sphinx.writers.latex import LaTeXTranslator\n\n import warnings\n warnings.warn(\"The numpydoc.only_directives module is deprecated;\"\n \"please use the only:: directive available in Sphinx >= 0.6\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L9_C4", "label": "from sphinx.latexwriter import LaTeXTranslator", "type": "import", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "vector": [1, 1, 0.0938, 0.0104, 1, 0.42, 0.0, 16, 0, 1, 0, 0, 16, 0, 0], "semantic": {"name": "sphinx.latexwriter", "arg_names": [], "import_names": ["LaTeXTranslator"], "rhs_call_name": "", "annotation": ""}, "snippet": " from sphinx.latexwriter import LaTeXTranslator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L11_C4", "label": "from sphinx.writers.latex import LaTeXTranslator", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "vector": [1, 1, 0.1146, 0.0104, 1, 0.42, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "sphinx.writers.latex", "arg_names": [], "import_names": ["LaTeXTranslator"], "rhs_call_name": "", "annotation": ""}, "snippet": " from sphinx.writers.latex import LaTeXTranslator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Import_L13_C4", "label": "warnings import warnings", "type": "import", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "vector": [1, 1, 0.1354, 0.0104, 1, 0.42, 0.5, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import warnings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L14_C4", "label": "warn()", "type": "expression", "loc": [14, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "vector": [8, 1, 0.1562, 0.0312, 1, 0.42, 1.0, 960, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " warnings.warn(\"The numpydoc.only_directives module is deprecated;\"\n \"please use the only:: directive available in Sphinx >= 0.6\",\n DeprecationWarning, stacklevel=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L18_C0", "label": "from docutils.parsers.rst import directives", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1875, 0.0104, 0, 0.66, 0.375, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "docutils.parsers.rst", "arg_names": [], "import_names": ["directives"], "rhs_call_name": "", "annotation": ""}, "snippet": "from docutils.parsers.rst import directives"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L20_C0", "label": "html_only", "type": "class", "loc": [20, 21], "level": 0, "parent": null, "vector": [3, 0, 0.2135, 0.0208, 0, 0.66, 0.5, 965, 0, 0, 0, 0, 52, 0, 0], "semantic": {"name": "html_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class html_only(Body, Element):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L23_C0", "label": "latex_only", "type": "class", "loc": [23, 24], "level": 0, "parent": null, "vector": [3, 0, 0.2448, 0.0208, 0, 0.66, 0.625, 931, 0, 0, 0, 0, 52, 0, 0], "semantic": {"name": "latex_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class latex_only(Body, Element):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "label": "run", "type": "function", "loc": [26, 30], "level": 0, "parent": null, "vector": [2, 0, 0.2917, 0.0521, 0, 0.66, 0.75, 679, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": ["content", "node_class", "state", "content_offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(content, node_class, state, content_offset):\n text = '\\n'.join(content)\n node = node_class(text)\n state.nested_parse(content, content_offset, node)\n return [node]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L27_C4", "label": "text = join()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "vector": [14, 1, 0.2812, 0.0104, 1, 0.34, 0.0, 439, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " text = '\\n'.join(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L28_C4", "label": "node = node_class()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "vector": [14, 1, 0.2917, 0.0104, 1, 0.34, 0.3333, 772, 3, 1, 0, 0, 218, 10, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "node_class", "annotation": ""}, "snippet": " node = node_class(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L29_C4", "label": "nested_parse()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "vector": [8, 1, 0.3021, 0.0104, 1, 0.34, 0.6667, 463, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "nested_parse", "arg_names": [], "import_names": [], "rhs_call_name": "nested_parse", "annotation": ""}, "snippet": " state.nested_parse(content, content_offset, node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "vector": [13, 1, 0.3125, 0.0104, 1, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [node]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "label": "try", "type": "try", "loc": [32, 72], "level": 0, "parent": null, "vector": [7, 0, 0.5417, 0.4271, 0, 0.66, 0.875, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from docutils.parsers.rst import Directive\nexcept ImportError:\n from docutils.parsers.rst.directives import _directives\n\n def html_only_directive(name, arguments, options, content, lineno,\n content_offset, block_text, state, state_machine):\n return run(content, html_only, state, content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L33_C4", "label": "from docutils.parsers.rst import Directive", "type": "import", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [1, 1, 0.3438, 0.0104, 1, 0.42, 0.0, 299, 0, 1, 0, 0, 299, 0, 0], "semantic": {"name": "docutils.parsers.rst", "arg_names": [], "import_names": ["Directive"], "rhs_call_name": "", "annotation": ""}, "snippet": " from docutils.parsers.rst import Directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L35_C4", "label": "from docutils.parsers.rst.directives import _directives", "type": "import", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [1, 1, 0.3646, 0.0104, 1, 0.42, 0.0, 836, 0, 1, 0, 0, 836, 0, 0], "semantic": {"name": "docutils.parsers.rst.directives", "arg_names": [], "import_names": ["_directives"], "rhs_call_name": "", "annotation": ""}, "snippet": " from docutils.parsers.rst.directives import _directives"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L37_C4", "label": "html_only_directive", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [2, 1, 0.3958, 0.0312, 1, 0.42, 0.2, 74, 0, 9, 1, 0, 0, 0, 1], "semantic": {"name": "html_only_directive", "arg_names": ["name", "arguments", "options", "content", "lineno", "content_offset", "block_text", "state", "state_machine"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def html_only_directive(name, arguments, options, content, lineno,\n content_offset, block_text, state, state_machine):\n return run(content, html_only, state, content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L37_C4", "vector": [13, 2, 0.4062, 0.0104, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return run(content, html_only, state, content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L41_C4", "label": "latex_only_directive", "type": "function", "loc": [41, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [2, 1, 0.4375, 0.0312, 1, 0.42, 0.4, 687, 0, 9, 1, 0, 0, 0, 1], "semantic": {"name": "latex_only_directive", "arg_names": ["name", "arguments", "options", "content", "lineno", "content_offset", "block_text", "state", "state_machine"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def latex_only_directive(name, arguments, options, content, lineno,\n content_offset, block_text, state, state_machine):\n return run(content, latex_only, state, content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L41_C4", "vector": [13, 2, 0.4479, 0.0104, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return run(content, latex_only, state, content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "label": "for func", "type": "for", "loc": [45, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [6, 1, 0.4844, 0.0417, 1, 0.42, 0.6, 856, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for func in (html_only_directive, latex_only_directive):\n func.content = 1\n func.options = {}\n func.arguments = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L46_C8", "label": "func.content =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "vector": [14, 2, 0.4792, 0.0104, 2, 0.05, 0.0, 191, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "func.content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.content = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L47_C8", "label": "func.options =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "vector": [14, 2, 0.4896, 0.0104, 2, 0.05, 0.5, 582, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "func.options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.options = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L48_C8", "label": "func.arguments =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "vector": [14, 2, 0.5, 0.0104, 2, 0.05, 1.0, 869, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "func.arguments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " func.arguments = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L50_C4", "label": "assign", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.42, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _directives['htmlonly'] = html_only_directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L51_C4", "label": "assign", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [14, 1, 0.5312, 0.0104, 1, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _directives['latexonly'] = latex_only_directive"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "label": "OnlyDirective", "type": "class", "loc": [53, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [3, 1, 0.6042, 0.1146, 1, 0.42, 0.2, 55, 0, 1, 0, 0, 520, 0, 2], "semantic": {"name": "OnlyDirective", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class OnlyDirective(Directive):\n has_content = True\n required_arguments = 0\n optional_arguments = 0\n final_argument_whitespace = True\n option_spec = {}\n\n def run(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L54_C8", "label": "has_content =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [14, 2, 0.5625, 0.0104, 2, 0.93, 0.0, 257, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_content = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L55_C8", "label": "required_arguments =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [14, 2, 0.5729, 0.0104, 2, 0.93, 0.2, 617, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "required_arguments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " required_arguments = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L56_C8", "label": "optional_arguments =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [14, 2, 0.5833, 0.0104, 2, 0.93, 0.4, 160, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "optional_arguments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " optional_arguments = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L57_C8", "label": "final_argument_whitespace =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [14, 2, 0.5938, 0.0104, 2, 0.93, 0.6, 127, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "final_argument_whitespace", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " final_argument_whitespace = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L58_C8", "label": "option_spec =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [14, 2, 0.6042, 0.0104, 2, 0.93, 0.8, 492, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "option_spec", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option_spec = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8", "label": "run", "type": "function", "loc": [60, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "vector": [2, 2, 0.6406, 0.0417, 2, 0.93, 1.0, 679, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n self.assert_has_content()\n return run(self.content, self.node_class,\n self.state, self.content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L61_C12", "label": "assert_has_content()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8", "vector": [8, 3, 0.6354, 0.0104, 3, 0.04, 0.0, 974, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "assert_has_content", "arg_names": [], "import_names": [], "rhs_call_name": "assert_has_content", "annotation": ""}, "snippet": " self.assert_has_content()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L62_C12", "label": "return", "type": "return", "loc": [62, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8", "vector": [13, 3, 0.651, 0.0208, 3, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return run(self.content, self.node_class,\n self.state, self.content_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L65_C4", "label": "HtmlOnlyDirective", "type": "class", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [3, 1, 0.6823, 0.0208, 1, 0.42, 0.4, 444, 0, 0, 0, 0, 55, 0, 0], "semantic": {"name": "HtmlOnlyDirective", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class HtmlOnlyDirective(OnlyDirective):\n node_class = html_only"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L66_C8", "label": "node_class =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L65_C4", "vector": [14, 2, 0.6875, 0.0104, 2, 0.04, 0.0, 218, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "node_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node_class = html_only"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L68_C4", "label": "LatexOnlyDirective", "type": "class", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [3, 1, 0.7135, 0.0208, 1, 0.42, 0.6, 782, 0, 0, 0, 0, 55, 0, 0], "semantic": {"name": "LatexOnlyDirective", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class LatexOnlyDirective(OnlyDirective):\n node_class = latex_only"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L69_C8", "label": "node_class =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L68_C4", "vector": [14, 2, 0.7188, 0.0104, 2, 0.51, 0.0, 218, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "node_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node_class = latex_only"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L71_C4", "label": "register_directive()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [8, 1, 0.7396, 0.0104, 1, 0.42, 0.8, 78, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_directive", "arg_names": [], "import_names": [], "rhs_call_name": "register_directive", "annotation": ""}, "snippet": " directives.register_directive('htmlonly', HtmlOnlyDirective)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L72_C4", "label": "register_directive()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "vector": [8, 1, 0.75, 0.0104, 1, 0.42, 1.0, 78, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_directive", "arg_names": [], "import_names": [], "rhs_call_name": "register_directive", "annotation": ""}, "snippet": " directives.register_directive('latexonly', LatexOnlyDirective)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "label": "setup", "type": "function", "loc": [74, 96], "level": 0, "parent": null, "vector": [2, 0, 0.8854, 0.2396, 0, 0.66, 1.0, 234, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setup", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup(app):\n app.add_node(html_only)\n app.add_node(latex_only)\n\n # Add visit/depart methods to HTML-Translator:\n def visit_perform(self, node):\n pass\n def depart_perform(self, node):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L75_C4", "label": "add_node()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [8, 1, 0.7812, 0.0104, 1, 0.17, 0.0, 659, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_node", "arg_names": [], "import_names": [], "rhs_call_name": "add_node", "annotation": ""}, "snippet": " app.add_node(html_only)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L76_C4", "label": "add_node()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [8, 1, 0.7917, 0.0104, 1, 0.17, 0.0769, 659, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_node", "arg_names": [], "import_names": [], "rhs_call_name": "add_node", "annotation": ""}, "snippet": " app.add_node(latex_only)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L79_C4", "label": "visit_perform", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [2, 1, 0.8281, 0.0208, 1, 0.17, 0.1538, 701, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "visit_perform", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def visit_perform(self, node):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L81_C4", "label": "depart_perform", "type": "function", "loc": [81, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [2, 1, 0.849, 0.0208, 1, 0.17, 0.2308, 828, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "depart_perform", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def depart_perform(self, node):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L83_C4", "label": "visit_ignore", "type": "function", "loc": [83, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [2, 1, 0.8698, 0.0208, 1, 0.17, 0.3077, 332, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "visit_ignore", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def visit_ignore(self, node):\n node.children = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L84_C8", "label": "node.children =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L83_C4", "vector": [14, 2, 0.875, 0.0104, 2, 0.57, 0.0, 56, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "node.children", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node.children = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L85_C4", "label": "depart_ignore", "type": "function", "loc": [85, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [2, 1, 0.8906, 0.0208, 1, 0.17, 0.3846, 372, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "depart_ignore", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def depart_ignore(self, node):\n node.children = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L86_C8", "label": "node.children =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L85_C4", "vector": [14, 2, 0.8958, 0.0104, 2, 0.92, 0.0, 56, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "node.children", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node.children = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L88_C4", "label": "HTMLTranslator.visit_html_only =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9167, 0.0104, 1, 0.17, 0.4615, 781, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HTMLTranslator.visit_html_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HTMLTranslator.visit_html_only = visit_perform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L89_C4", "label": "HTMLTranslator.depart_html_only =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9271, 0.0104, 1, 0.17, 0.5385, 612, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HTMLTranslator.depart_html_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HTMLTranslator.depart_html_only = depart_perform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L90_C4", "label": "HTMLTranslator.visit_latex_only =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9375, 0.0104, 1, 0.17, 0.6154, 824, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HTMLTranslator.visit_latex_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HTMLTranslator.visit_latex_only = visit_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L91_C4", "label": "HTMLTranslator.depart_latex_only =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9479, 0.0104, 1, 0.17, 0.6923, 115, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HTMLTranslator.depart_latex_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HTMLTranslator.depart_latex_only = depart_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L93_C4", "label": "LaTeXTranslator.visit_html_only =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9688, 0.0104, 1, 0.17, 0.7692, 11, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LaTeXTranslator.visit_html_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LaTeXTranslator.visit_html_only = visit_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L94_C4", "label": "LaTeXTranslator.depart_html_only =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9792, 0.0104, 1, 0.17, 0.8462, 736, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LaTeXTranslator.depart_html_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LaTeXTranslator.depart_html_only = depart_ignore"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L95_C4", "label": "LaTeXTranslator.visit_latex_only =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 0.9896, 0.0104, 1, 0.17, 0.9231, 205, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LaTeXTranslator.visit_latex_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LaTeXTranslator.visit_latex_only = visit_perform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L96_C4", "label": "LaTeXTranslator.depart_latex_only =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "vector": [14, 1, 1.0, 0.0104, 1, 0.17, 1.0, 404, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LaTeXTranslator.depart_latex_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LaTeXTranslator.depart_latex_only = depart_perform"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Import_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:For_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Return_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:ClassDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:Try_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_756:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_756:Assign_L96_C4"}] |
from cStringIO import StringIO
import compiler
import inspect
import textwrap
import tokenize
from compiler_unparse import unparse
class Comment(object):
""" A comment block.
"""
is_comment = True
def __init__(self, start_lineno, end_lineno, text):
# int : The first line number in the block. 1-indexed.
self.start_lineno = start_lineno
# int : The last line number. Inclusive!
self.end_lineno = end_lineno
# str : The text block including '#' character but not any leading spaces.
self.text = text
def add(self, string, start, end, line):
""" Add a new comment line.
"""
self.start_lineno = min(self.start_lineno, start[0])
self.end_lineno = max(self.end_lineno, end[0])
self.text += string
def __repr__(self):
return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno,
self.end_lineno, self.text)
class NonComment(object):
""" A non-comment block of code.
"""
is_comment = False
def __init__(self, start_lineno, end_lineno):
self.start_lineno = start_lineno
self.end_lineno = end_lineno
def add(self, string, start, end, line):
""" Add lines to the block.
"""
if string.strip():
# Only add if not entirely whitespace.
self.start_lineno = min(self.start_lineno, start[0])
self.end_lineno = max(self.end_lineno, end[0])
def __repr__(self):
return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno,
self.end_lineno)
class CommentBlocker(object):
""" Pull out contiguous comment blocks.
"""
def __init__(self):
# Start with a dummy.
self.current_block = NonComment(0, 0)
# All of the blocks seen so far.
self.blocks = []
# The index mapping lines of code to their associated comment blocks.
self.index = {}
def process_file(self, file):
""" Process a file object.
"""
for token in tokenize.generate_tokens(file.next):
self.process_token(*token)
self.make_index()
def process_token(self, kind, string, start, end, line):
""" Process a single token.
"""
if self.current_block.is_comment:
if kind == tokenize.COMMENT:
self.current_block.add(string, start, end, line)
else:
self.new_noncomment(start[0], end[0])
else:
if kind == tokenize.COMMENT:
self.new_comment(string, start, end, line)
else:
self.current_block.add(string, start, end, line)
def new_noncomment(self, start_lineno, end_lineno):
""" We are transitioning from a noncomment to a comment.
"""
block = NonComment(start_lineno, end_lineno)
self.blocks.append(block)
self.current_block = block
def new_comment(self, string, start, end, line):
""" Possibly add a new comment.
Only adds a new comment if this comment is the only thing on the line.
Otherwise, it extends the noncomment block.
"""
prefix = line[:start[1]]
if prefix.strip():
# Oops! Trailing comment, not a comment block.
self.current_block.add(string, start, end, line)
else:
# A comment block.
block = Comment(start[0], end[0], string)
self.blocks.append(block)
self.current_block = block
def make_index(self):
""" Make the index mapping lines of actual code to their associated
prefix comments.
"""
for prev, block in zip(self.blocks[:-1], self.blocks[1:]):
if not block.is_comment:
self.index[block.start_lineno] = prev
def search_for_comment(self, lineno, default=None):
""" Find the comment block just before the given line number.
Returns None (or the specified default) if there is no such block.
"""
if not self.index:
self.make_index()
block = self.index.get(lineno, None)
text = getattr(block, 'text', default)
return text
def strip_comment_marker(text):
""" Strip # markers at the front of a block of comment text.
"""
lines = []
for line in text.splitlines():
lines.append(line.lstrip('#'))
text = textwrap.dedent('\n'.join(lines))
return text
def get_class_traits(klass):
""" Yield all of the documentation for trait definitions on a class object.
"""
# FIXME: gracefully handle errors here or in the caller?
source = inspect.getsource(klass)
cb = CommentBlocker()
cb.process_file(StringIO(source))
mod_ast = compiler.parse(source)
class_ast = mod_ast.node.nodes[0]
for node in class_ast.code.nodes:
# FIXME: handle other kinds of assignments?
if isinstance(node, compiler.ast.Assign):
name = node.nodes[0].name
rhs = unparse(node.expr).strip()
doc = strip_comment_marker(cb.search_for_comment(node.lineno, default=''))
yield name, rhs, doc
| ajibawa-2023/Python-Code-Large/train/row_757 | 97 | 158 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_757:ImportFrom_L1_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Import_L2_C0", "label": "compiler import compiler", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0063, 0, 0.66, 0.1, 738, 0, 1, 0, 0, 738, 0, 0], "semantic": {"name": "compiler", "arg_names": [], "import_names": ["compiler"], "rhs_call_name": "", "annotation": ""}, "snippet": "import compiler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Import_L3_C0", "label": "inspect import inspect", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.019, 0.0063, 0, 0.66, 0.2, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"], "rhs_call_name": "", "annotation": ""}, "snippet": "import inspect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Import_L4_C0", "label": "textwrap import textwrap", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0253, 0.0063, 0, 0.66, 0.3, 641, 0, 1, 0, 0, 641, 0, 0], "semantic": {"name": "textwrap", "arg_names": [], "import_names": ["textwrap"], "rhs_call_name": "", "annotation": ""}, "snippet": "import textwrap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Import_L5_C0", "label": "tokenize import tokenize", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0316, 0.0063, 0, 0.66, 0.4, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "tokenize", "arg_names": [], "import_names": ["tokenize"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tokenize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:ImportFrom_L7_C0", "label": "from compiler_unparse import unparse", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0443, 0.0063, 0, 0.66, 0.5, 991, 0, 1, 0, 0, 991, 0, 0], "semantic": {"name": "compiler_unparse", "arg_names": [], "import_names": ["unparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from compiler_unparse import unparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "label": "Comment", "type": "class", "loc": [10, 31], "level": 0, "parent": null, "vector": [3, 0, 0.1297, 0.1392, 0, 0.66, 0.6, 846, 0, 3, 0, 0, 186, 0, 2], "semantic": {"name": "Comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Comment(object):\n \"\"\" A comment block.\n \"\"\"\n is_comment = True\n def __init__(self, start_lineno, end_lineno, text):\n # int : The first line number in the block. 1-indexed.\n self.start_lineno = start_lineno\n # int : The last line number. Inclusive!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "vector": [8, 1, 0.0728, 0.0127, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" A comment block.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L13_C4", "label": "is_comment =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "vector": [14, 1, 0.0823, 0.0063, 1, 0.33, 0.25, 530, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "is_comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_comment = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "vector": [2, 1, 0.1076, 0.0443, 1, 0.33, 0.5, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "start_lineno", "end_lineno", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, start_lineno, end_lineno, text):\n # int : The first line number in the block. 1-indexed.\n self.start_lineno = start_lineno\n # int : The last line number. Inclusive!\n self.end_lineno = end_lineno\n # str : The text block including '#' character but not any leading spaces.\n self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L16_C8", "label": "self.start_lineno =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "vector": [14, 2, 0.1013, 0.0063, 2, 0.99, 0.0, 265, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.start_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.start_lineno = start_lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L18_C8", "label": "self.end_lineno =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "vector": [14, 2, 0.1139, 0.0063, 2, 0.99, 0.5, 656, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.end_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.end_lineno = end_lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L20_C8", "label": "self.text =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "vector": [14, 2, 0.1266, 0.0063, 2, 0.99, 1.0, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "label": "add", "type": "function", "loc": [22, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "vector": [2, 1, 0.1551, 0.038, 1, 0.33, 0.75, 241, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": ["self", "string", "start", "end", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, string, start, end, line):\n \"\"\" Add a new comment line.\n \"\"\"\n self.start_lineno = min(self.start_lineno, start[0])\n self.end_lineno = max(self.end_lineno, end[0])\n self.text += string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L23_C8", "label": "expression", "type": "expression", "loc": [23, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "vector": [8, 2, 0.1487, 0.0127, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Add a new comment line.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L25_C8", "label": "self.start_lineno = min()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "vector": [14, 2, 0.1582, 0.0063, 2, 0.99, 0.5, 265, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "self.start_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " self.start_lineno = min(self.start_lineno, start[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L26_C8", "label": "self.end_lineno = max()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "vector": [14, 2, 0.1646, 0.0063, 2, 0.99, 1.0, 656, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "self.end_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " self.end_lineno = max(self.end_lineno, end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L29_C4", "label": "__repr__", "type": "function", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "vector": [2, 1, 0.1899, 0.019, 1, 0.33, 1.0, 204, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno,\n self.end_lineno, self.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L29_C4", "vector": [13, 2, 0.193, 0.0127, 2, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno,\n self.end_lineno, self.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "label": "NonComment", "type": "class", "loc": [34, 52], "level": 0, "parent": null, "vector": [3, 0, 0.2722, 0.1203, 0, 0.66, 0.7, 817, 0, 3, 0, 0, 186, 0, 3], "semantic": {"name": "NonComment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NonComment(object):\n \"\"\" A non-comment block of code.\n \"\"\"\n is_comment = False\n def __init__(self, start_lineno, end_lineno):\n self.start_lineno = start_lineno\n self.end_lineno = end_lineno\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "vector": [8, 1, 0.2247, 0.0127, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" A non-comment block of code.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L37_C4", "label": "is_comment =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "vector": [14, 1, 0.2342, 0.0063, 1, 0.44, 0.25, 530, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "is_comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_comment = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4", "label": "__init__", "type": "function", "loc": [38, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "vector": [2, 1, 0.2468, 0.019, 1, 0.44, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "start_lineno", "end_lineno"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, start_lineno, end_lineno):\n self.start_lineno = start_lineno\n self.end_lineno = end_lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L39_C8", "label": "self.start_lineno =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4", "vector": [14, 2, 0.2468, 0.0063, 2, 0.14, 0.0, 265, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.start_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.start_lineno = start_lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L40_C8", "label": "self.end_lineno =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4", "vector": [14, 2, 0.2532, 0.0063, 2, 0.14, 1.0, 656, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.end_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.end_lineno = end_lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4", "label": "add", "type": "function", "loc": [42, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "vector": [2, 1, 0.2848, 0.0443, 1, 0.44, 0.75, 241, 0, 5, 0, 0, 0, 0, 3], "semantic": {"name": "add", "arg_names": ["self", "string", "start", "end", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, string, start, end, line):\n \"\"\" Add lines to the block.\n \"\"\"\n if string.strip():\n # Only add if not entirely whitespace.\n self.start_lineno = min(self.start_lineno, start[0])\n self.end_lineno = max(self.end_lineno, end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L43_C8", "label": "expression", "type": "expression", "loc": [43, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4", "vector": [8, 2, 0.2753, 0.0127, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Add lines to the block.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8", "label": "if", "type": "if", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4", "vector": [4, 2, 0.2943, 0.0253, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if string.strip():\n # Only add if not entirely whitespace.\n self.start_lineno = min(self.start_lineno, start[0])\n self.end_lineno = max(self.end_lineno, end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L47_C12", "label": "self.start_lineno = min()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8", "vector": [14, 3, 0.2975, 0.0063, 3, 0.3, 0.0, 265, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "self.start_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " self.start_lineno = min(self.start_lineno, start[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L48_C12", "label": "self.end_lineno = max()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8", "vector": [14, 3, 0.3038, 0.0063, 3, 0.3, 1.0, 656, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "self.end_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " self.end_lineno = max(self.end_lineno, end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L50_C4", "label": "__repr__", "type": "function", "loc": [50, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "vector": [2, 1, 0.3228, 0.019, 1, 0.44, 1.0, 204, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno,\n self.end_lineno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L50_C4", "vector": [13, 2, 0.3259, 0.0127, 2, 0.12, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno,\n self.end_lineno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "label": "CommentBlocker", "type": "class", "loc": [55, 129], "level": 0, "parent": null, "vector": [3, 0, 0.5823, 0.4747, 0, 0.66, 0.8, 672, 0, 7, 0, 0, 186, 0, 18], "semantic": {"name": "CommentBlocker", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommentBlocker(object):\n \"\"\" Pull out contiguous comment blocks.\n \"\"\"\n def __init__(self):\n # Start with a dummy.\n self.current_block = NonComment(0, 0)\n\n # All of the blocks seen so far."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L56_C4", "label": "expression", "type": "expression", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [8, 1, 0.3576, 0.0127, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Pull out contiguous comment blocks.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "label": "__init__", "type": "function", "loc": [58, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.3924, 0.057, 1, 0.06, 0.1429, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n # Start with a dummy.\n self.current_block = NonComment(0, 0)\n\n # All of the blocks seen so far.\n self.blocks = []\n\n # The index mapping lines of code to their associated comment blocks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L60_C8", "label": "self.current_block = NonComment()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "vector": [14, 2, 0.3797, 0.0063, 2, 0.66, 0.0, 389, 3, 2, 0, 0, 817, 10, 1], "semantic": {"name": "self.current_block", "arg_names": [], "import_names": [], "rhs_call_name": "NonComment", "annotation": ""}, "snippet": " self.current_block = NonComment(0, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L63_C8", "label": "self.blocks =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "vector": [14, 2, 0.3987, 0.0063, 2, 0.66, 0.5, 356, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blocks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L66_C8", "label": "self.index =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "vector": [14, 2, 0.4177, 0.0063, 2, 0.66, 1.0, 777, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.index = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "label": "process_file", "type": "function", "loc": [68, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.4462, 0.038, 1, 0.06, 0.2857, 769, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "process_file", "arg_names": ["self", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_file(self, file):\n \"\"\" Process a file object.\n \"\"\"\n for token in tokenize.generate_tokens(file.next):\n self.process_token(*token)\n self.make_index()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L69_C8", "label": "expression", "type": "expression", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "vector": [8, 2, 0.4399, 0.0127, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Process a file object.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:For_L71_C8", "label": "for token", "type": "for", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "vector": [6, 2, 0.4525, 0.0127, 2, 0.72, 0.5, 129, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for token in tokenize.generate_tokens(file.next):\n self.process_token(*token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L72_C12", "label": "process_token()", "type": "expression", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:For_L71_C8", "vector": [8, 3, 0.4557, 0.0063, 3, 0.87, 0.0, 205, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_token", "arg_names": [], "import_names": [], "rhs_call_name": "process_token", "annotation": ""}, "snippet": " self.process_token(*token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L73_C8", "label": "make_index()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "vector": [8, 2, 0.462, 0.0063, 2, 0.72, 1.0, 659, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "make_index", "arg_names": [], "import_names": [], "rhs_call_name": "make_index", "annotation": ""}, "snippet": " self.make_index()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4", "label": "process_token", "type": "function", "loc": [75, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.5127, 0.0823, 1, 0.06, 0.4286, 205, 0, 6, 0, 0, 0, 0, 4], "semantic": {"name": "process_token", "arg_names": ["self", "kind", "string", "start", "end", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_token(self, kind, string, start, end, line):\n \"\"\" Process a single token.\n \"\"\"\n if self.current_block.is_comment:\n if kind == tokenize.COMMENT:\n self.current_block.add(string, start, end, line)\n else:\n self.new_noncomment(start[0], end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L76_C8", "label": "expression", "type": "expression", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4", "vector": [8, 2, 0.4842, 0.0127, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Process a single token.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8", "label": "if", "type": "if", "loc": [78, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4", "vector": [4, 2, 0.5222, 0.0633, 2, 0.5, 1.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.current_block.is_comment:\n if kind == tokenize.COMMENT:\n self.current_block.add(string, start, end, line)\n else:\n self.new_noncomment(start[0], end[0])\n else:\n if kind == tokenize.COMMENT:\n self.new_comment(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12", "label": "if", "type": "if", "loc": [79, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8", "vector": [4, 3, 0.5095, 0.0253, 3, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if kind == tokenize.COMMENT:\n self.current_block.add(string, start, end, line)\n else:\n self.new_noncomment(start[0], end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L80_C16", "label": "add()", "type": "expression", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12", "vector": [8, 4, 0.5063, 0.0063, 4, 0.06, 0.0, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.current_block.add(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L82_C16", "label": "new_noncomment()", "type": "expression", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12", "vector": [8, 4, 0.519, 0.0063, 4, 0.06, 1.0, 813, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "new_noncomment", "arg_names": [], "import_names": [], "rhs_call_name": "new_noncomment", "annotation": ""}, "snippet": " self.new_noncomment(start[0], end[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12", "label": "if", "type": "if", "loc": [84, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8", "vector": [4, 3, 0.5411, 0.0253, 3, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if kind == tokenize.COMMENT:\n self.new_comment(string, start, end, line)\n else:\n self.current_block.add(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L85_C16", "label": "new_comment()", "type": "expression", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12", "vector": [8, 4, 0.538, 0.0063, 4, 0.31, 0.0, 32, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "new_comment", "arg_names": [], "import_names": [], "rhs_call_name": "new_comment", "annotation": ""}, "snippet": " self.new_comment(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L87_C16", "label": "add()", "type": "expression", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12", "vector": [8, 4, 0.5506, 0.0063, 4, 0.31, 1.0, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.current_block.add(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "label": "new_noncomment", "type": "function", "loc": [89, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.5791, 0.038, 1, 0.06, 0.5714, 813, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "new_noncomment", "arg_names": ["self", "start_lineno", "end_lineno"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_noncomment(self, start_lineno, end_lineno):\n \"\"\" We are transitioning from a noncomment to a comment.\n \"\"\"\n block = NonComment(start_lineno, end_lineno)\n self.blocks.append(block)\n self.current_block = block"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L90_C8", "label": "expression", "type": "expression", "loc": [90, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "vector": [8, 2, 0.5728, 0.0127, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" We are transitioning from a noncomment to a comment.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L92_C8", "label": "block = NonComment()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "vector": [14, 2, 0.5823, 0.0063, 2, 0.73, 0.3333, 506, 3, 2, 0, 0, 817, 10, 1], "semantic": {"name": "block", "arg_names": [], "import_names": [], "rhs_call_name": "NonComment", "annotation": ""}, "snippet": " block = NonComment(start_lineno, end_lineno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L93_C8", "label": "append()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "vector": [8, 2, 0.5886, 0.0063, 2, 0.73, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blocks.append(block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L94_C8", "label": "self.current_block =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "vector": [14, 2, 0.5949, 0.0063, 2, 0.73, 1.0, 389, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_block", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_block = block"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "label": "new_comment", "type": "function", "loc": [96, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.6519, 0.0949, 1, 0.06, 0.7143, 32, 0, 5, 0, 0, 0, 0, 4], "semantic": {"name": "new_comment", "arg_names": ["self", "string", "start", "end", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_comment(self, string, start, end, line):\n \"\"\" Possibly add a new comment.\n \n Only adds a new comment if this comment is the only thing on the line.\n Otherwise, it extends the noncomment block.\n \"\"\"\n prefix = line[:start[1]]\n if prefix.strip():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L97_C8", "label": "expression", "type": "expression", "loc": [97, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "vector": [8, 2, 0.6266, 0.0316, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Possibly add a new comment.\n \n Only adds a new comment if this comment is the only thing on the line.\n Otherwise, it extends the noncomment block.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L102_C8", "label": "prefix =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "vector": [14, 2, 0.6456, 0.0063, 2, 0.93, 0.5, 284, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = line[:start[1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "label": "if", "type": "if", "loc": [103, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "vector": [4, 2, 0.6741, 0.0506, 2, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if prefix.strip():\n # Oops! Trailing comment, not a comment block.\n self.current_block.add(string, start, end, line)\n else:\n # A comment block.\n block = Comment(start[0], end[0], string)\n self.blocks.append(block)\n self.current_block = block"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L105_C12", "label": "add()", "type": "expression", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "vector": [8, 3, 0.6646, 0.0063, 3, 0.88, 0.0, 241, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.current_block.add(string, start, end, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L108_C12", "label": "block = Comment()", "type": "assigned_variable", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "vector": [14, 3, 0.6835, 0.0063, 3, 0.88, 0.3333, 506, 3, 3, 0, 0, 846, 10, 1], "semantic": {"name": "block", "arg_names": [], "import_names": [], "rhs_call_name": "Comment", "annotation": ""}, "snippet": " block = Comment(start[0], end[0], string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L109_C12", "label": "append()", "type": "expression", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "vector": [8, 3, 0.6899, 0.0063, 3, 0.88, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blocks.append(block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L110_C12", "label": "self.current_block =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "vector": [14, 3, 0.6962, 0.0063, 3, 0.88, 1.0, 389, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.current_block", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.current_block = block"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4", "label": "make_index", "type": "function", "loc": [112, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.7278, 0.0443, 1, 0.06, 0.8571, 659, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "make_index", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def make_index(self):\n \"\"\" Make the index mapping lines of actual code to their associated\n prefix comments.\n \"\"\"\n for prev, block in zip(self.blocks[:-1], self.blocks[1:]):\n if not block.is_comment:\n self.index[block.start_lineno] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4", "vector": [8, 2, 0.7215, 0.019, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Make the index mapping lines of actual code to their associated\n prefix comments.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:For_L116_C8", "label": "for prev, block", "type": "for", "loc": [116, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4", "vector": [6, 2, 0.7405, 0.019, 2, 0.5, 1.0, 943, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "prev, block", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for prev, block in zip(self.blocks[:-1], self.blocks[1:]):\n if not block.is_comment:\n self.index[block.start_lineno] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L117_C12", "label": "if", "type": "if", "loc": [117, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:For_L116_C8", "vector": [4, 3, 0.7437, 0.0127, 3, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not block.is_comment:\n self.index[block.start_lineno] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L118_C16", "label": "assign", "type": "assigned_variable", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L117_C12", "vector": [14, 4, 0.7468, 0.0063, 4, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.index[block.start_lineno] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "label": "search_for_comment", "type": "function", "loc": [120, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "vector": [2, 1, 0.788, 0.0633, 1, 0.06, 1.0, 486, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "search_for_comment", "arg_names": ["self", "lineno", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def search_for_comment(self, lineno, default=None):\n \"\"\" Find the comment block just before the given line number.\n\n Returns None (or the specified default) if there is no such block.\n \"\"\"\n if not self.index:\n self.make_index()\n block = self.index.get(lineno, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L121_C8", "label": "expression", "type": "expression", "loc": [121, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "vector": [8, 2, 0.7753, 0.0253, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Find the comment block just before the given line number.\n\n Returns None (or the specified default) if there is no such block.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L125_C8", "label": "if", "type": "if", "loc": [125, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "vector": [4, 2, 0.7943, 0.0127, 2, 0.04, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.index:\n self.make_index()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L126_C12", "label": "make_index()", "type": "expression", "loc": [126, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L125_C8", "vector": [8, 3, 0.7975, 0.0063, 3, 0.38, 0.0, 659, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "make_index", "arg_names": [], "import_names": [], "rhs_call_name": "make_index", "annotation": ""}, "snippet": " self.make_index()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L127_C8", "label": "block = get()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "vector": [14, 2, 0.8038, 0.0063, 2, 0.04, 0.5, 506, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "block", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " block = self.index.get(lineno, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L128_C8", "label": "text = getattr()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "vector": [14, 2, 0.8101, 0.0063, 2, 0.04, 0.75, 439, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " text = getattr(block, 'text', default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "vector": [13, 2, 0.8165, 0.0063, 2, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "label": "strip_comment_marker", "type": "function", "loc": [132, 139], "level": 0, "parent": null, "vector": [2, 0, 0.8576, 0.0506, 0, 0.66, 0.9, 334, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "strip_comment_marker", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def strip_comment_marker(text):\n \"\"\" Strip # markers at the front of a block of comment text.\n \"\"\"\n lines = []\n for line in text.splitlines():\n lines.append(line.lstrip('#'))\n text = textwrap.dedent('\\n'.join(lines))\n return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L133_C4", "label": "expression", "type": "expression", "loc": [133, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "vector": [8, 1, 0.8449, 0.0127, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Strip # markers at the front of a block of comment text.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L135_C4", "label": "lines =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "vector": [14, 1, 0.8544, 0.0063, 1, 0.13, 0.25, 73, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lines = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:For_L136_C4", "label": "for line", "type": "for", "loc": [136, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "vector": [6, 1, 0.8639, 0.0127, 1, 0.13, 0.5, 373, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in text.splitlines():\n lines.append(line.lstrip('#'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L137_C8", "label": "append()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:For_L136_C4", "vector": [8, 2, 0.8671, 0.0063, 2, 0.56, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lines.append(line.lstrip('#'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L138_C4", "label": "text = dedent()", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "vector": [14, 1, 0.8734, 0.0063, 1, 0.13, 0.75, 439, 3, 1, 0, 0, 899, 10, 2], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "dedent", "annotation": ""}, "snippet": " text = textwrap.dedent('\\n'.join(lines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L139_C4", "label": "return", "type": "return", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "vector": [13, 1, 0.8797, 0.0063, 1, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "label": "get_class_traits", "type": "function", "loc": [142, 157], "level": 0, "parent": null, "vector": [2, 0, 0.9462, 0.1013, 0, 0.66, 1.0, 406, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "get_class_traits", "arg_names": ["klass"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_class_traits(klass):\n \"\"\" Yield all of the documentation for trait definitions on a class object.\n \"\"\"\n # FIXME: gracefully handle errors here or in the caller?\n source = inspect.getsource(klass)\n cb = CommentBlocker()\n cb.process_file(StringIO(source))\n mod_ast = compiler.parse(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L143_C4", "label": "expression", "type": "expression", "loc": [143, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [8, 1, 0.9082, 0.0127, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Yield all of the documentation for trait definitions on a class object.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L146_C4", "label": "source = getsource()", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [14, 1, 0.9241, 0.0063, 1, 0.57, 0.1667, 703, 3, 1, 0, 0, 154, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "getsource", "annotation": ""}, "snippet": " source = inspect.getsource(klass)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L147_C4", "label": "cb = CommentBlocker()", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [14, 1, 0.9304, 0.0063, 1, 0.57, 0.3333, 540, 3, 0, 0, 0, 672, 10, 1], "semantic": {"name": "cb", "arg_names": [], "import_names": [], "rhs_call_name": "CommentBlocker", "annotation": ""}, "snippet": " cb = CommentBlocker()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L148_C4", "label": "process_file()", "type": "expression", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [8, 1, 0.9367, 0.0063, 1, 0.57, 0.5, 769, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "process_file", "arg_names": [], "import_names": [], "rhs_call_name": "process_file", "annotation": ""}, "snippet": " cb.process_file(StringIO(source))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L149_C4", "label": "mod_ast = parse()", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [14, 1, 0.943, 0.0063, 1, 0.57, 0.6667, 810, 3, 1, 0, 0, 678, 10, 1], "semantic": {"name": "mod_ast", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " mod_ast = compiler.parse(source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L150_C4", "label": "class_ast =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [14, 1, 0.9494, 0.0063, 1, 0.57, 0.8333, 104, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "class_ast", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_ast = mod_ast.node.nodes[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:For_L151_C4", "label": "for node", "type": "for", "loc": [151, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "vector": [6, 1, 0.9747, 0.0443, 1, 0.57, 1.0, 772, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in class_ast.code.nodes:\n # FIXME: handle other kinds of assignments?\n if isinstance(node, compiler.ast.Assign):\n name = node.nodes[0].name\n rhs = unparse(node.expr).strip()\n doc = strip_comment_marker(cb.search_for_comment(node.lineno, default=''))\n yield name, rhs, doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "label": "if", "type": "if", "loc": [153, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:For_L151_C4", "vector": [4, 2, 0.981, 0.0316, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, compiler.ast.Assign):\n name = node.nodes[0].name\n rhs = unparse(node.expr).strip()\n doc = strip_comment_marker(cb.search_for_comment(node.lineno, default=''))\n yield name, rhs, doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L154_C12", "label": "name =", "type": "assigned_variable", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "vector": [14, 3, 0.9747, 0.0063, 3, 0.52, 0.0, 57, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = node.nodes[0].name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L155_C12", "label": "rhs = strip()", "type": "assigned_variable", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "vector": [14, 3, 0.981, 0.0063, 3, 0.52, 0.3333, 461, 3, 0, 0, 0, 973, 10, 2], "semantic": {"name": "rhs", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " rhs = unparse(node.expr).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L156_C12", "label": "doc = strip_comment_marker()", "type": "assigned_variable", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "vector": [14, 3, 0.9873, 0.0063, 3, 0.52, 0.6667, 555, 3, 1, 0, 0, 334, 10, 2], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "strip_comment_marker", "annotation": ""}, "snippet": " doc = strip_comment_marker(cb.search_for_comment(node.lineno, default=''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L157_C12", "label": "expression", "type": "expression", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "vector": [8, 3, 0.9937, 0.0063, 3, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield name, rhs, doc"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:For_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:For_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L84_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:For_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L125_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:For_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:For_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L132_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Return_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:FunctionDef_L142_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_757:For_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:For_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Assign_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_757:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_757:Expr_L157_C12"}] |
from distutils.core import setup
import setuptools
import sys, os
version = "0.2.dev"
setup(
name="numpydoc",
packages=["numpydoc"],
package_dir={"numpydoc": ""},
version=version,
description="Sphinx extension to support docstrings in Numpy format",
# classifiers from http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=["Development Status :: 3 - Alpha",
"Environment :: Plugins",
"License :: OSI Approved :: BSD License",
"Topic :: Documentation"],
keywords="sphinx numpy",
author="Pauli Virtanen and others",
author_email="pav@iki.fi",
url="http://projects.scipy.org/numpy/browser/trunk/doc/sphinxext",
license="BSD",
zip_safe=False,
install_requires=["Sphinx >= 0.5"],
package_data={'numpydoc': 'tests'},
entry_points={
"console_scripts": [
"autosummary_generate = numpydoc.autosummary_generate:main",
],
},
)
| ajibawa-2023/Python-Code-Large/train/row_760 | 5 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_760:ImportFrom_L1_C0", "label": "from distutils.core import setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 0, 0.66, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from distutils.core import setup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_760:Import_L2_C0", "label": "setuptools import setuptools", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 0, 0.66, 0.25, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setuptools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import setuptools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_760:Import_L3_C0", "label": "sys import sys, os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0323, 0, 0.66, 0.5, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_760:Assign_L5_C0", "label": "version =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1613, 0.0323, 0, 0.66, 0.75, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = \"0.2.dev\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_760:Expr_L7_C0", "label": "setup()", "type": "expression", "loc": [7, 31], "level": 0, "parent": null, "vector": [8, 0, 0.6129, 0.8065, 0, 0.66, 1.0, 234, 3, 15, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(\n name=\"numpydoc\",\n packages=[\"numpydoc\"],\n package_dir={\"numpydoc\": \"\"},\n version=version,\n description=\"Sphinx extension to support docstrings in Numpy format\",\n # classifiers from http://pypi.python.org/pypi?%3Aaction=list_classifiers\n classifiers=[\"Development Status :: 3 - Alpha\","}] | [] |
""" Turn compiler.ast structures back into executable python code.
The unparse method takes a compiler.ast tree and transforms it back into
valid python code. It is incomplete and currently only works for
import statements, function calls, function definitions, assignments, and
basic expressions.
Inspired by python-2.5-svn/Demo/parser/unparse.py
fixme: We may want to move to using _ast trees because the compiler for
them is about 6 times faster than compiler.compile.
"""
import sys
import cStringIO
from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add
def unparse(ast, single_line_functions=False):
s = cStringIO.StringIO()
UnparseCompilerAst(ast, s, single_line_functions)
return s.getvalue().lstrip()
op_precedence = { 'compiler.ast.Power':3, 'compiler.ast.Mul':2, 'compiler.ast.Div':2,
'compiler.ast.Add':1, 'compiler.ast.Sub':1 }
class UnparseCompilerAst:
""" Methods in this class recursively traverse an AST and
output source code for the abstract syntax; original formatting
is disregarged.
"""
#########################################################################
# object interface.
#########################################################################
def __init__(self, tree, file = sys.stdout, single_line_functions=False):
""" Unparser(tree, file=sys.stdout) -> None.
Print the source for tree to file.
"""
self.f = file
self._single_func = single_line_functions
self._do_indent = True
self._indent = 0
self._dispatch(tree)
self._write("\n")
self.f.flush()
#########################################################################
# Unparser private interface.
#########################################################################
### format, output, and dispatch methods ################################
def _fill(self, text = ""):
"Indent a piece of text, according to the current indentation level"
if self._do_indent:
self._write("\n"+" "*self._indent + text)
else:
self._write(text)
def _write(self, text):
"Append a piece of text to the current line."
self.f.write(text)
def _enter(self):
"Print ':', and increase the indentation."
self._write(": ")
self._indent += 1
def _leave(self):
"Decrease the indentation level."
self._indent -= 1
def _dispatch(self, tree):
"_dispatcher function, _dispatching tree type T to method _T."
if isinstance(tree, list):
for t in tree:
self._dispatch(t)
return
meth = getattr(self, "_"+tree.__class__.__name__)
if tree.__class__.__name__ == 'NoneType' and not self._do_indent:
return
meth(tree)
#########################################################################
# compiler.ast unparsing methods.
#
# There should be one method per concrete grammar type. They are
# organized in alphabetical order.
#########################################################################
def _Add(self, t):
self.__binary_op(t, '+')
def _And(self, t):
self._write(" (")
for i, node in enumerate(t.nodes):
self._dispatch(node)
if i != len(t.nodes)-1:
self._write(") and (")
self._write(")")
def _AssAttr(self, t):
""" Handle assigning an attribute of an object
"""
self._dispatch(t.expr)
self._write('.'+t.attrname)
def _Assign(self, t):
""" Expression Assignment such as "a = 1".
This only handles assignment in expressions. Keyword assignment
is handled separately.
"""
self._fill()
for target in t.nodes:
self._dispatch(target)
self._write(" = ")
self._dispatch(t.expr)
if not self._do_indent:
self._write('; ')
def _AssName(self, t):
""" Name on left hand side of expression.
Treat just like a name on the right side of an expression.
"""
self._Name(t)
def _AssTuple(self, t):
""" Tuple on left hand side of an expression.
"""
# _write each elements, separated by a comma.
for element in t.nodes[:-1]:
self._dispatch(element)
self._write(", ")
# Handle the last one without writing comma
last_element = t.nodes[-1]
self._dispatch(last_element)
def _AugAssign(self, t):
""" +=,-=,*=,/=,**=, etc. operations
"""
self._fill()
self._dispatch(t.node)
self._write(' '+t.op+' ')
self._dispatch(t.expr)
if not self._do_indent:
self._write(';')
def _Bitand(self, t):
""" Bit and operation.
"""
for i, node in enumerate(t.nodes):
self._write("(")
self._dispatch(node)
self._write(")")
if i != len(t.nodes)-1:
self._write(" & ")
def _Bitor(self, t):
""" Bit or operation
"""
for i, node in enumerate(t.nodes):
self._write("(")
self._dispatch(node)
self._write(")")
if i != len(t.nodes)-1:
self._write(" | ")
def _CallFunc(self, t):
""" Function call.
"""
self._dispatch(t.node)
self._write("(")
comma = False
for e in t.args:
if comma: self._write(", ")
else: comma = True
self._dispatch(e)
if t.star_args:
if comma: self._write(", ")
else: comma = True
self._write("*")
self._dispatch(t.star_args)
if t.dstar_args:
if comma: self._write(", ")
else: comma = True
self._write("**")
self._dispatch(t.dstar_args)
self._write(")")
def _Compare(self, t):
self._dispatch(t.expr)
for op, expr in t.ops:
self._write(" " + op + " ")
self._dispatch(expr)
def _Const(self, t):
""" A constant value such as an integer value, 3, or a string, "hello".
"""
self._dispatch(t.value)
def _Decorators(self, t):
""" Handle function decorators (eg. @has_units)
"""
for node in t.nodes:
self._dispatch(node)
def _Dict(self, t):
self._write("{")
for i, (k, v) in enumerate(t.items):
self._dispatch(k)
self._write(": ")
self._dispatch(v)
if i < len(t.items)-1:
self._write(", ")
self._write("}")
def _Discard(self, t):
""" Node for when return value is ignored such as in "foo(a)".
"""
self._fill()
self._dispatch(t.expr)
def _Div(self, t):
self.__binary_op(t, '/')
def _Ellipsis(self, t):
self._write("...")
def _From(self, t):
""" Handle "from xyz import foo, bar as baz".
"""
# fixme: Are From and ImportFrom handled differently?
self._fill("from ")
self._write(t.modname)
self._write(" import ")
for i, (name,asname) in enumerate(t.names):
if i != 0:
self._write(", ")
self._write(name)
if asname is not None:
self._write(" as "+asname)
def _Function(self, t):
""" Handle function definitions
"""
if t.decorators is not None:
self._fill("@")
self._dispatch(t.decorators)
self._fill("def "+t.name + "(")
defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults)
for i, arg in enumerate(zip(t.argnames, defaults)):
self._write(arg[0])
if arg[1] is not None:
self._write('=')
self._dispatch(arg[1])
if i < len(t.argnames)-1:
self._write(', ')
self._write(")")
if self._single_func:
self._do_indent = False
self._enter()
self._dispatch(t.code)
self._leave()
self._do_indent = True
def _Getattr(self, t):
""" Handle getting an attribute of an object
"""
if isinstance(t.expr, (Div, Mul, Sub, Add)):
self._write('(')
self._dispatch(t.expr)
self._write(')')
else:
self._dispatch(t.expr)
self._write('.'+t.attrname)
def _If(self, t):
self._fill()
for i, (compare,code) in enumerate(t.tests):
if i == 0:
self._write("if ")
else:
self._write("elif ")
self._dispatch(compare)
self._enter()
self._fill()
self._dispatch(code)
self._leave()
self._write("\n")
if t.else_ is not None:
self._write("else")
self._enter()
self._fill()
self._dispatch(t.else_)
self._leave()
self._write("\n")
def _IfExp(self, t):
self._dispatch(t.then)
self._write(" if ")
self._dispatch(t.test)
if t.else_ is not None:
self._write(" else (")
self._dispatch(t.else_)
self._write(")")
def _Import(self, t):
""" Handle "import xyz.foo".
"""
self._fill("import ")
for i, (name,asname) in enumerate(t.names):
if i != 0:
self._write(", ")
self._write(name)
if asname is not None:
self._write(" as "+asname)
def _Keyword(self, t):
""" Keyword value assignment within function calls and definitions.
"""
self._write(t.name)
self._write("=")
self._dispatch(t.expr)
def _List(self, t):
self._write("[")
for i,node in enumerate(t.nodes):
self._dispatch(node)
if i < len(t.nodes)-1:
self._write(", ")
self._write("]")
def _Module(self, t):
if t.doc is not None:
self._dispatch(t.doc)
self._dispatch(t.node)
def _Mul(self, t):
self.__binary_op(t, '*')
def _Name(self, t):
self._write(t.name)
def _NoneType(self, t):
self._write("None")
def _Not(self, t):
self._write('not (')
self._dispatch(t.expr)
self._write(')')
def _Or(self, t):
self._write(" (")
for i, node in enumerate(t.nodes):
self._dispatch(node)
if i != len(t.nodes)-1:
self._write(") or (")
self._write(")")
def _Pass(self, t):
self._write("pass\n")
def _Printnl(self, t):
self._fill("print ")
if t.dest:
self._write(">> ")
self._dispatch(t.dest)
self._write(", ")
comma = False
for node in t.nodes:
if comma: self._write(', ')
else: comma = True
self._dispatch(node)
def _Power(self, t):
self.__binary_op(t, '**')
def _Return(self, t):
self._fill("return ")
if t.value:
if isinstance(t.value, Tuple):
text = ', '.join([ name.name for name in t.value.asList() ])
self._write(text)
else:
self._dispatch(t.value)
if not self._do_indent:
self._write('; ')
def _Slice(self, t):
self._dispatch(t.expr)
self._write("[")
if t.lower:
self._dispatch(t.lower)
self._write(":")
if t.upper:
self._dispatch(t.upper)
#if t.step:
# self._write(":")
# self._dispatch(t.step)
self._write("]")
def _Sliceobj(self, t):
for i, node in enumerate(t.nodes):
if i != 0:
self._write(":")
if not (isinstance(node, Const) and node.value is None):
self._dispatch(node)
def _Stmt(self, tree):
for node in tree.nodes:
self._dispatch(node)
def _Sub(self, t):
self.__binary_op(t, '-')
def _Subscript(self, t):
self._dispatch(t.expr)
self._write("[")
for i, value in enumerate(t.subs):
if i != 0:
self._write(",")
self._dispatch(value)
self._write("]")
def _TryExcept(self, t):
self._fill("try")
self._enter()
self._dispatch(t.body)
self._leave()
for handler in t.handlers:
self._fill('except ')
self._dispatch(handler[0])
if handler[1] is not None:
self._write(', ')
self._dispatch(handler[1])
self._enter()
self._dispatch(handler[2])
self._leave()
if t.else_:
self._fill("else")
self._enter()
self._dispatch(t.else_)
self._leave()
def _Tuple(self, t):
if not t.nodes:
# Empty tuple.
self._write("()")
else:
self._write("(")
# _write each elements, separated by a comma.
for element in t.nodes[:-1]:
self._dispatch(element)
self._write(", ")
# Handle the last one without writing comma
last_element = t.nodes[-1]
self._dispatch(last_element)
self._write(")")
def _UnaryAdd(self, t):
self._write("+")
self._dispatch(t.expr)
def _UnarySub(self, t):
self._write("-")
self._dispatch(t.expr)
def _With(self, t):
self._fill('with ')
self._dispatch(t.expr)
if t.vars:
self._write(' as ')
self._dispatch(t.vars.name)
self._enter()
self._dispatch(t.body)
self._leave()
self._write('\n')
def _int(self, t):
self._write(repr(t))
def __binary_op(self, t, symbol):
# Check if parenthesis are needed on left side and then dispatch
has_paren = False
left_class = str(t.left.__class__)
if (left_class in op_precedence.keys() and
op_precedence[left_class] < op_precedence[str(t.__class__)]):
has_paren = True
if has_paren:
self._write('(')
self._dispatch(t.left)
if has_paren:
self._write(')')
# Write the appropriate symbol for operator
self._write(symbol)
# Check if parenthesis are needed on the right side and then dispatch
has_paren = False
right_class = str(t.right.__class__)
if (right_class in op_precedence.keys() and
op_precedence[right_class] < op_precedence[str(t.__class__)]):
has_paren = True
if has_paren:
self._write('(')
self._dispatch(t.right)
if has_paren:
self._write(')')
def _float(self, t):
# if t is 0.1, str(t)->'0.1' while repr(t)->'0.1000000000001'
# We prefer str here.
self._write(str(t))
def _str(self, t):
self._write(repr(t))
def _tuple(self, t):
self._write(str(t))
#########################################################################
# These are the methods from the _ast modules unparse.
#
# As our needs to handle more advanced code increase, we may want to
# modify some of the methods below so that they work for compiler.ast.
#########################################################################
# # stmt
# def _Expr(self, tree):
# self._fill()
# self._dispatch(tree.value)
#
# def _Import(self, t):
# self._fill("import ")
# first = True
# for a in t.names:
# if first:
# first = False
# else:
# self._write(", ")
# self._write(a.name)
# if a.asname:
# self._write(" as "+a.asname)
#
## def _ImportFrom(self, t):
## self._fill("from ")
## self._write(t.module)
## self._write(" import ")
## for i, a in enumerate(t.names):
## if i == 0:
## self._write(", ")
## self._write(a.name)
## if a.asname:
## self._write(" as "+a.asname)
## # XXX(jpe) what is level for?
##
#
# def _Break(self, t):
# self._fill("break")
#
# def _Continue(self, t):
# self._fill("continue")
#
# def _Delete(self, t):
# self._fill("del ")
# self._dispatch(t.targets)
#
# def _Assert(self, t):
# self._fill("assert ")
# self._dispatch(t.test)
# if t.msg:
# self._write(", ")
# self._dispatch(t.msg)
#
# def _Exec(self, t):
# self._fill("exec ")
# self._dispatch(t.body)
# if t.globals:
# self._write(" in ")
# self._dispatch(t.globals)
# if t.locals:
# self._write(", ")
# self._dispatch(t.locals)
#
# def _Print(self, t):
# self._fill("print ")
# do_comma = False
# if t.dest:
# self._write(">>")
# self._dispatch(t.dest)
# do_comma = True
# for e in t.values:
# if do_comma:self._write(", ")
# else:do_comma=True
# self._dispatch(e)
# if not t.nl:
# self._write(",")
#
# def _Global(self, t):
# self._fill("global")
# for i, n in enumerate(t.names):
# if i != 0:
# self._write(",")
# self._write(" " + n)
#
# def _Yield(self, t):
# self._fill("yield")
# if t.value:
# self._write(" (")
# self._dispatch(t.value)
# self._write(")")
#
# def _Raise(self, t):
# self._fill('raise ')
# if t.type:
# self._dispatch(t.type)
# if t.inst:
# self._write(", ")
# self._dispatch(t.inst)
# if t.tback:
# self._write(", ")
# self._dispatch(t.tback)
#
#
# def _TryFinally(self, t):
# self._fill("try")
# self._enter()
# self._dispatch(t.body)
# self._leave()
#
# self._fill("finally")
# self._enter()
# self._dispatch(t.finalbody)
# self._leave()
#
# def _excepthandler(self, t):
# self._fill("except ")
# if t.type:
# self._dispatch(t.type)
# if t.name:
# self._write(", ")
# self._dispatch(t.name)
# self._enter()
# self._dispatch(t.body)
# self._leave()
#
# def _ClassDef(self, t):
# self._write("\n")
# self._fill("class "+t.name)
# if t.bases:
# self._write("(")
# for a in t.bases:
# self._dispatch(a)
# self._write(", ")
# self._write(")")
# self._enter()
# self._dispatch(t.body)
# self._leave()
#
# def _FunctionDef(self, t):
# self._write("\n")
# for deco in t.decorators:
# self._fill("@")
# self._dispatch(deco)
# self._fill("def "+t.name + "(")
# self._dispatch(t.args)
# self._write(")")
# self._enter()
# self._dispatch(t.body)
# self._leave()
#
# def _For(self, t):
# self._fill("for ")
# self._dispatch(t.target)
# self._write(" in ")
# self._dispatch(t.iter)
# self._enter()
# self._dispatch(t.body)
# self._leave()
# if t.orelse:
# self._fill("else")
# self._enter()
# self._dispatch(t.orelse)
# self._leave
#
# def _While(self, t):
# self._fill("while ")
# self._dispatch(t.test)
# self._enter()
# self._dispatch(t.body)
# self._leave()
# if t.orelse:
# self._fill("else")
# self._enter()
# self._dispatch(t.orelse)
# self._leave
#
# # expr
# def _Str(self, tree):
# self._write(repr(tree.s))
##
# def _Repr(self, t):
# self._write("`")
# self._dispatch(t.value)
# self._write("`")
#
# def _Num(self, t):
# self._write(repr(t.n))
#
# def _ListComp(self, t):
# self._write("[")
# self._dispatch(t.elt)
# for gen in t.generators:
# self._dispatch(gen)
# self._write("]")
#
# def _GeneratorExp(self, t):
# self._write("(")
# self._dispatch(t.elt)
# for gen in t.generators:
# self._dispatch(gen)
# self._write(")")
#
# def _comprehension(self, t):
# self._write(" for ")
# self._dispatch(t.target)
# self._write(" in ")
# self._dispatch(t.iter)
# for if_clause in t.ifs:
# self._write(" if ")
# self._dispatch(if_clause)
#
# def _IfExp(self, t):
# self._dispatch(t.body)
# self._write(" if ")
# self._dispatch(t.test)
# if t.orelse:
# self._write(" else ")
# self._dispatch(t.orelse)
#
# unop = {"Invert":"~", "Not": "not", "UAdd":"+", "USub":"-"}
# def _UnaryOp(self, t):
# self._write(self.unop[t.op.__class__.__name__])
# self._write("(")
# self._dispatch(t.operand)
# self._write(")")
#
# binop = { "Add":"+", "Sub":"-", "Mult":"*", "Div":"/", "Mod":"%",
# "LShift":">>", "RShift":"<<", "BitOr":"|", "BitXor":"^", "BitAnd":"&",
# "FloorDiv":"//", "Pow": "**"}
# def _BinOp(self, t):
# self._write("(")
# self._dispatch(t.left)
# self._write(")" + self.binop[t.op.__class__.__name__] + "(")
# self._dispatch(t.right)
# self._write(")")
#
# boolops = {_ast.And: 'and', _ast.Or: 'or'}
# def _BoolOp(self, t):
# self._write("(")
# self._dispatch(t.values[0])
# for v in t.values[1:]:
# self._write(" %s " % self.boolops[t.op.__class__])
# self._dispatch(v)
# self._write(")")
#
# def _Attribute(self,t):
# self._dispatch(t.value)
# self._write(".")
# self._write(t.attr)
#
## def _Call(self, t):
## self._dispatch(t.func)
## self._write("(")
## comma = False
## for e in t.args:
## if comma: self._write(", ")
## else: comma = True
## self._dispatch(e)
## for e in t.keywords:
## if comma: self._write(", ")
## else: comma = True
## self._dispatch(e)
## if t.starargs:
## if comma: self._write(", ")
## else: comma = True
## self._write("*")
## self._dispatch(t.starargs)
## if t.kwargs:
## if comma: self._write(", ")
## else: comma = True
## self._write("**")
## self._dispatch(t.kwargs)
## self._write(")")
#
# # slice
# def _Index(self, t):
# self._dispatch(t.value)
#
# def _ExtSlice(self, t):
# for i, d in enumerate(t.dims):
# if i != 0:
# self._write(': ')
# self._dispatch(d)
#
# # others
# def _arguments(self, t):
# first = True
# nonDef = len(t.args)-len(t.defaults)
# for a in t.args[0:nonDef]:
# if first:first = False
# else: self._write(", ")
# self._dispatch(a)
# for a,d in zip(t.args[nonDef:], t.defaults):
# if first:first = False
# else: self._write(", ")
# self._dispatch(a),
# self._write("=")
# self._dispatch(d)
# if t.vararg:
# if first:first = False
# else: self._write(", ")
# self._write("*"+t.vararg)
# if t.kwarg:
# if first:first = False
# else: self._write(", ")
# self._write("**"+t.kwarg)
#
## def _keyword(self, t):
## self._write(t.arg)
## self._write("=")
## self._dispatch(t.value)
#
# def _Lambda(self, t):
# self._write("lambda ")
# self._dispatch(t.args)
# self._write(": ")
# self._dispatch(t.body)
| ajibawa-2023/Python-Code-Large/train/row_761 | 386 | 860 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0076, 0.014, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\" Turn compiler.ast structures back into executable python code.\n\n The unparse method takes a compiler.ast tree and transforms it back into\n valid python code. It is incomplete and currently only works for\n import statements, function calls, function definitions, assignments, and\n basic expressions.\n\n Inspired by python-2.5-svn/Demo/parser/unparse.py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0163, 0.0012, 0, 0.66, 0.1667, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Import_L15_C0", "label": "cStringIO import cStringIO", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0174, 0.0012, 0, 0.66, 0.3333, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["cStringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cStringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:ImportFrom_L16_C0", "label": "from compiler.ast import Const, Name, Tuple\u2026", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0186, 0.0012, 0, 0.66, 0.5, 598, 0, 7, 0, 0, 598, 0, 0], "semantic": {"name": "compiler.ast", "arg_names": [], "import_names": ["Const", "Name", "Tuple", "Div", "Mul", "Sub", "Add"], "rhs_call_name": "", "annotation": ""}, "snippet": "from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "label": "unparse", "type": "function", "loc": [18, 21], "level": 0, "parent": null, "vector": [2, 0, 0.0227, 0.0047, 0, 0.66, 0.6667, 747, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "unparse", "arg_names": ["ast", "single_line_functions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unparse(ast, single_line_functions=False):\n s = cStringIO.StringIO()\n UnparseCompilerAst(ast, s, single_line_functions)\n return s.getvalue().lstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L19_C4", "label": "s = StringIO()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "vector": [14, 1, 0.0221, 0.0012, 1, 0.33, 0.0, 553, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " s = cStringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L20_C4", "label": "UnparseCompilerAst()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "vector": [8, 1, 0.0233, 0.0012, 1, 0.33, 0.5, 533, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "UnparseCompilerAst", "arg_names": [], "import_names": [], "rhs_call_name": "UnparseCompilerAst", "annotation": ""}, "snippet": " UnparseCompilerAst(ast, s, single_line_functions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "vector": [13, 1, 0.0244, 0.0012, 1, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s.getvalue().lstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L23_C0", "label": "op_precedence =", "type": "assigned_variable", "loc": [23, 24], "level": 0, "parent": null, "vector": [14, 0, 0.0273, 0.0023, 0, 0.66, 0.8333, 971, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "op_precedence", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "op_precedence = { 'compiler.ast.Power':3, 'compiler.ast.Mul':2, 'compiler.ast.Div':2,\n 'compiler.ast.Add':1, 'compiler.ast.Sub':1 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "label": "UnparseCompilerAst", "type": "class", "loc": [26, 538], "level": 0, "parent": null, "vector": [3, 0, 0.3279, 0.5965, 0, 0.66, 1.0, 533, 0, 56, 0, 0, 0, 0, 99], "semantic": {"name": "UnparseCompilerAst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UnparseCompilerAst:\n \"\"\" Methods in this class recursively traverse an AST and\n output source code for the abstract syntax; original formatting\n is disregarged.\n \"\"\"\n\n #########################################################################\n # object interface."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L27_C4", "label": "expression", "type": "expression", "loc": [27, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [8, 1, 0.0331, 0.0047, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Methods in this class recursively traverse an AST and\n output source code for the abstract syntax; original formatting\n is disregarged.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "label": "__init__", "type": "function", "loc": [36, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0483, 0.014, 1, 0.01, 0.0179, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "tree", "file", "single_line_functions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, tree, file = sys.stdout, single_line_functions=False):\n \"\"\" Unparser(tree, file=sys.stdout) -> None.\n\n Print the source for tree to file.\n \"\"\"\n self.f = file\n self._single_func = single_line_functions\n self._do_indent = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L37_C8", "label": "expression", "type": "expression", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [8, 2, 0.0448, 0.0047, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Unparser(tree, file=sys.stdout) -> None.\n\n Print the source for tree to file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L41_C8", "label": "self.f =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [14, 2, 0.0477, 0.0012, 2, 0.13, 0.1429, 596, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.f = file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L42_C8", "label": "self._single_func =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [14, 2, 0.0488, 0.0012, 2, 0.13, 0.2857, 73, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._single_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._single_func = single_line_functions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L43_C8", "label": "self._do_indent =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [14, 2, 0.05, 0.0012, 2, 0.13, 0.4286, 11, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._do_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._do_indent = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L44_C8", "label": "self._indent =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [14, 2, 0.0512, 0.0012, 2, 0.13, 0.5714, 765, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._indent = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L45_C8", "label": "_dispatch()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [8, 2, 0.0523, 0.0012, 2, 0.13, 0.7143, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(tree)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L46_C8", "label": "_write()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [8, 2, 0.0535, 0.0012, 2, 0.13, 0.8571, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L47_C8", "label": "flush()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "vector": [8, 2, 0.0547, 0.0012, 2, 0.13, 1.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " self.f.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4", "label": "_fill", "type": "function", "loc": [55, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0669, 0.007, 1, 0.01, 0.0357, 754, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_fill", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fill(self, text = \"\"):\n \"Indent a piece of text, according to the current indentation level\"\n if self._do_indent:\n self._write(\"\\n\"+\" \"*self._indent + text)\n else:\n self._write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L56_C8", "label": "expression", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4", "vector": [8, 2, 0.0651, 0.0012, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Indent a piece of text, according to the current indentation level\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4", "vector": [4, 2, 0.068, 0.0047, 2, 0.94, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._do_indent:\n self._write(\"\\n\"+\" \"*self._indent + text)\n else:\n self._write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L58_C12", "label": "_write()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8", "vector": [8, 3, 0.0674, 0.0012, 3, 0.22, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"\\n\"+\" \"*self._indent + text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L60_C12", "label": "_write()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8", "vector": [8, 3, 0.0698, 0.0012, 3, 0.22, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4", "label": "_write", "type": "function", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0733, 0.0035, 1, 0.01, 0.0536, 961, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _write(self, text):\n \"Append a piece of text to the current line.\"\n self.f.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4", "vector": [8, 2, 0.0733, 0.0012, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Append a piece of text to the current line.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L64_C8", "label": "write()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4", "vector": [8, 2, 0.0744, 0.0012, 2, 0.45, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.f.write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4", "label": "_enter", "type": "function", "loc": [66, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0785, 0.0047, 1, 0.01, 0.0714, 922, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _enter(self):\n \"Print ':', and increase the indentation.\"\n self._write(\": \")\n self._indent += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4", "vector": [8, 2, 0.0779, 0.0012, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Print ':', and increase the indentation.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L68_C8", "label": "_write()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4", "vector": [8, 2, 0.0791, 0.0012, 2, 0.33, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\": \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L71_C4", "label": "_leave", "type": "function", "loc": [71, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0837, 0.0035, 1, 0.01, 0.0893, 620, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_leave", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _leave(self):\n \"Decrease the indentation level.\"\n self._indent -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L72_C8", "label": "expression", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L71_C4", "vector": [8, 2, 0.0837, 0.0012, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Decrease the indentation level.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "label": "_dispatch", "type": "function", "loc": [75, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.0924, 0.0116, 1, 0.01, 0.1071, 835, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "_dispatch", "arg_names": ["self", "tree"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _dispatch(self, tree):\n \"_dispatcher function, _dispatching tree type T to method _T.\"\n if isinstance(tree, list):\n for t in tree:\n self._dispatch(t)\n return\n meth = getattr(self, \"_\"+tree.__class__.__name__)\n if tree.__class__.__name__ == 'NoneType' and not self._do_indent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L76_C8", "label": "expression", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "vector": [8, 2, 0.0884, 0.0012, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"_dispatcher function, _dispatching tree type T to method _T.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8", "label": "if", "type": "if", "loc": [77, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "vector": [4, 2, 0.0913, 0.0047, 2, 0.98, 0.25, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(tree, list):\n for t in tree:\n self._dispatch(t)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L78_C12", "label": "for t", "type": "for", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8", "vector": [6, 3, 0.0913, 0.0023, 3, 0.78, 0.0, 15, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in tree:\n self._dispatch(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L79_C16", "label": "_dispatch()", "type": "expression", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L78_C12", "vector": [8, 4, 0.0919, 0.0012, 4, 0.83, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L80_C12", "label": "return", "type": "return", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8", "vector": [13, 3, 0.093, 0.0012, 3, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L81_C8", "label": "meth = getattr()", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "vector": [14, 2, 0.0942, 0.0012, 2, 0.98, 0.5, 110, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "meth", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " meth = getattr(self, \"_\"+tree.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L82_C8", "label": "if", "type": "if", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "vector": [4, 2, 0.0959, 0.0023, 2, 0.98, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tree.__class__.__name__ == 'NoneType' and not self._do_indent:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L83_C12", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L82_C8", "vector": [13, 3, 0.0965, 0.0012, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L84_C8", "label": "meth()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "vector": [8, 2, 0.0977, 0.0012, 2, 0.98, 1.0, 110, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "meth", "arg_names": [], "import_names": [], "rhs_call_name": "meth", "annotation": ""}, "snippet": " meth(tree)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L94_C4", "label": "_Add", "type": "function", "loc": [94, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1099, 0.0023, 1, 0.01, 0.125, 922, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Add", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Add(self, t):\n self.__binary_op(t, '+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L95_C8", "label": "__binary_op()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L94_C4", "vector": [8, 2, 0.1105, 0.0012, 2, 0.27, 0.0, 413, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__binary_op", "arg_names": [], "import_names": [], "rhs_call_name": "__binary_op", "annotation": ""}, "snippet": " self.__binary_op(t, '+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "label": "_And", "type": "function", "loc": [97, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1163, 0.0081, 1, 0.01, 0.1429, 539, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_And", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _And(self, t):\n self._write(\" (\")\n for i, node in enumerate(t.nodes):\n self._dispatch(node)\n if i != len(t.nodes)-1:\n self._write(\") and (\")\n self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L98_C8", "label": "_write()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "vector": [8, 2, 0.114, 0.0012, 2, 0.62, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8", "label": "for i, node", "type": "for", "loc": [99, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "vector": [6, 2, 0.1169, 0.0047, 2, 0.62, 0.5, 483, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, node in enumerate(t.nodes):\n self._dispatch(node)\n if i != len(t.nodes)-1:\n self._write(\") and (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L100_C12", "label": "_dispatch()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8", "vector": [8, 3, 0.1163, 0.0012, 3, 0.18, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L101_C12", "label": "if", "type": "if", "loc": [101, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8", "vector": [4, 3, 0.118, 0.0023, 3, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != len(t.nodes)-1:\n self._write(\") and (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L102_C16", "label": "_write()", "type": "expression", "loc": [102, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L101_C12", "vector": [8, 4, 0.1186, 0.0012, 4, 0.47, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\") and (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L103_C8", "label": "_write()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "vector": [8, 2, 0.1198, 0.0012, 2, 0.62, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "label": "_AssAttr", "type": "function", "loc": [105, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1244, 0.0058, 1, 0.01, 0.1607, 894, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_AssAttr", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _AssAttr(self, t):\n \"\"\" Handle assigning an attribute of an object\n \"\"\"\n self._dispatch(t.expr)\n self._write('.'+t.attrname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "vector": [8, 2, 0.1238, 0.0023, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle assigning an attribute of an object\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L108_C8", "label": "_dispatch()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "vector": [8, 2, 0.1256, 0.0012, 2, 0.51, 0.5, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L109_C8", "label": "_write()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "vector": [8, 2, 0.1267, 0.0012, 2, 0.51, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('.'+t.attrname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "label": "_Assign", "type": "function", "loc": [111, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.136, 0.0151, 1, 0.01, 0.1786, 676, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "_Assign", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Assign(self, t):\n \"\"\" Expression Assignment such as \"a = 1\".\n\n This only handles assignment in expressions. Keyword assignment\n is handled separately.\n \"\"\"\n self._fill()\n for target in t.nodes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L112_C8", "label": "expression", "type": "expression", "loc": [112, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "vector": [8, 2, 0.1326, 0.0058, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Expression Assignment such as \"a = 1\".\n\n This only handles assignment in expressions. Keyword assignment\n is handled separately.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L117_C8", "label": "_fill()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "vector": [8, 2, 0.136, 0.0012, 2, 0.63, 0.25, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8", "label": "for target", "type": "for", "loc": [118, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "vector": [6, 2, 0.1384, 0.0035, 2, 0.63, 0.5, 766, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for target in t.nodes:\n self._dispatch(target)\n self._write(\" = \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L119_C12", "label": "_dispatch()", "type": "expression", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8", "vector": [8, 3, 0.1384, 0.0012, 3, 0.82, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L120_C12", "label": "_write()", "type": "expression", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8", "vector": [8, 3, 0.1395, 0.0012, 3, 0.82, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" = \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L121_C8", "label": "_dispatch()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "vector": [8, 2, 0.1407, 0.0012, 2, 0.63, 0.75, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L122_C8", "label": "if", "type": "if", "loc": [122, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "vector": [4, 2, 0.1424, 0.0023, 2, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._do_indent:\n self._write('; ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L123_C12", "label": "_write()", "type": "expression", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L122_C8", "vector": [8, 3, 0.143, 0.0012, 3, 0.6, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('; ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4", "label": "_AssName", "type": "function", "loc": [125, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1483, 0.007, 1, 0.01, 0.1964, 582, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_AssName", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _AssName(self, t):\n \"\"\" Name on left hand side of expression.\n\n Treat just like a name on the right side of an expression.\n \"\"\"\n self._Name(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L126_C8", "label": "expression", "type": "expression", "loc": [126, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4", "vector": [8, 2, 0.1483, 0.0047, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Name on left hand side of expression.\n\n Treat just like a name on the right side of an expression.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L130_C8", "label": "_Name()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4", "vector": [8, 2, 0.1512, 0.0012, 2, 0.47, 1.0, 27, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_Name", "arg_names": [], "import_names": [], "rhs_call_name": "_Name", "annotation": ""}, "snippet": " self._Name(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "label": "_AssTuple", "type": "function", "loc": [132, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1599, 0.014, 1, 0.01, 0.2143, 571, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_AssTuple", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _AssTuple(self, t):\n \"\"\" Tuple on left hand side of an expression.\n \"\"\"\n\n # _write each elements, separated by a comma.\n for element in t.nodes[:-1]:\n self._dispatch(element)\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L133_C8", "label": "expression", "type": "expression", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "vector": [8, 2, 0.1552, 0.0023, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Tuple on left hand side of an expression.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8", "label": "for element", "type": "for", "loc": [137, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "vector": [6, 2, 0.1605, 0.0035, 2, 0.14, 0.3333, 736, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for element in t.nodes[:-1]:\n self._dispatch(element)\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L138_C12", "label": "_dispatch()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8", "vector": [8, 3, 0.1605, 0.0012, 3, 0.46, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L139_C12", "label": "_write()", "type": "expression", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8", "vector": [8, 3, 0.1616, 0.0012, 3, 0.46, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L142_C8", "label": "last_element =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "vector": [14, 2, 0.1651, 0.0012, 2, 0.14, 0.6667, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_element = t.nodes[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L143_C8", "label": "_dispatch()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "vector": [8, 2, 0.1663, 0.0012, 2, 0.14, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(last_element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "label": "_AugAssign", "type": "function", "loc": [145, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1738, 0.0116, 1, 0.01, 0.2321, 641, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "_AugAssign", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _AugAssign(self, t):\n \"\"\" +=,-=,*=,/=,**=, etc. operations\n \"\"\"\n \n self._fill()\n self._dispatch(t.node)\n self._write(' '+t.op+' ')\n self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L146_C8", "label": "expression", "type": "expression", "loc": [146, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [8, 2, 0.1703, 0.0023, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" +=,-=,*=,/=,**=, etc. operations\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L149_C8", "label": "_fill()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [8, 2, 0.1733, 0.0012, 2, 0.69, 0.2, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L150_C8", "label": "_dispatch()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [8, 2, 0.1744, 0.0012, 2, 0.69, 0.4, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L151_C8", "label": "_write()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [8, 2, 0.1756, 0.0012, 2, 0.69, 0.6, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(' '+t.op+' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L152_C8", "label": "_dispatch()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [8, 2, 0.1767, 0.0012, 2, 0.69, 0.8, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L153_C8", "label": "if", "type": "if", "loc": [153, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "vector": [4, 2, 0.1785, 0.0023, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._do_indent:\n self._write(';')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L154_C12", "label": "_write()", "type": "expression", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L153_C8", "vector": [8, 3, 0.1791, 0.0012, 3, 0.43, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(';')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4", "label": "_Bitand", "type": "function", "loc": [156, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1866, 0.0116, 1, 0.01, 0.25, 920, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Bitand", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Bitand(self, t):\n \"\"\" Bit and operation.\n \"\"\"\n \n for i, node in enumerate(t.nodes):\n self._write(\"(\")\n self._dispatch(node)\n self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4", "vector": [8, 2, 0.1831, 0.0023, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Bit and operation.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "label": "for i, node", "type": "for", "loc": [160, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4", "vector": [6, 2, 0.189, 0.007, 2, 0.37, 1.0, 483, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, node in enumerate(t.nodes):\n self._write(\"(\")\n self._dispatch(node)\n self._write(\")\")\n if i != len(t.nodes)-1:\n self._write(\" & \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L161_C12", "label": "_write()", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "vector": [8, 3, 0.1872, 0.0012, 3, 0.94, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L162_C12", "label": "_dispatch()", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "vector": [8, 3, 0.1884, 0.0012, 3, 0.94, 0.3333, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L163_C12", "label": "_write()", "type": "expression", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "vector": [8, 3, 0.1895, 0.0012, 3, 0.94, 0.6667, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L164_C12", "label": "if", "type": "if", "loc": [164, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "vector": [4, 3, 0.1913, 0.0023, 3, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != len(t.nodes)-1:\n self._write(\" & \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L165_C16", "label": "_write()", "type": "expression", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L164_C12", "vector": [8, 4, 0.1919, 0.0012, 4, 0.25, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" & \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4", "label": "_Bitor", "type": "function", "loc": [167, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.1994, 0.0116, 1, 0.01, 0.2679, 836, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Bitor", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Bitor(self, t):\n \"\"\" Bit or operation\n \"\"\"\n \n for i, node in enumerate(t.nodes):\n self._write(\"(\")\n self._dispatch(node)\n self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L168_C8", "label": "expression", "type": "expression", "loc": [168, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4", "vector": [8, 2, 0.1959, 0.0023, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Bit or operation\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "label": "for i, node", "type": "for", "loc": [171, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4", "vector": [6, 2, 0.2017, 0.007, 2, 0.77, 1.0, 483, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, node in enumerate(t.nodes):\n self._write(\"(\")\n self._dispatch(node)\n self._write(\")\")\n if i != len(t.nodes)-1:\n self._write(\" | \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L172_C12", "label": "_write()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "vector": [8, 3, 0.2, 0.0012, 3, 0.31, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L173_C12", "label": "_dispatch()", "type": "expression", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "vector": [8, 3, 0.2012, 0.0012, 3, 0.31, 0.3333, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L174_C12", "label": "_write()", "type": "expression", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "vector": [8, 3, 0.2023, 0.0012, 3, 0.31, 0.6667, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L175_C12", "label": "if", "type": "if", "loc": [175, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "vector": [4, 3, 0.2041, 0.0023, 3, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != len(t.nodes)-1:\n self._write(\" | \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L176_C16", "label": "_write()", "type": "expression", "loc": [176, 176], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L175_C12", "vector": [8, 4, 0.2047, 0.0012, 4, 0.66, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" | \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "label": "_CallFunc", "type": "function", "loc": [178, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2186, 0.0244, 1, 0.01, 0.2857, 365, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "_CallFunc", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CallFunc(self, t):\n \"\"\" Function call.\n \"\"\"\n self._dispatch(t.node)\n self._write(\"(\")\n comma = False\n for e in t.args:\n if comma: self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L179_C8", "label": "expression", "type": "expression", "loc": [179, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [8, 2, 0.2087, 0.0023, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Function call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L181_C8", "label": "_dispatch()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [8, 2, 0.2105, 0.0012, 2, 0.94, 0.1429, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L182_C8", "label": "_write()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [8, 2, 0.2116, 0.0012, 2, 0.94, 0.2857, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L183_C8", "label": "comma =", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [14, 2, 0.2128, 0.0012, 2, 0.94, 0.4286, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comma = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8", "label": "for e", "type": "for", "loc": [184, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [6, 2, 0.2157, 0.0047, 2, 0.94, 0.5714, 175, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for e in t.args:\n if comma: self._write(\", \")\n else: comma = True\n self._dispatch(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12", "label": "if", "type": "if", "loc": [185, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8", "vector": [4, 3, 0.2157, 0.0023, 3, 0.49, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comma: self._write(\", \")\n else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L185_C22", "label": "_write()", "type": "expression", "loc": [185, 185], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12", "vector": [8, 4, 0.2151, 0.0012, 4, 0.81, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " if comma: self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L186_C18", "label": "comma =", "type": "assigned_variable", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12", "vector": [14, 4, 0.2163, 0.0012, 4, 0.81, 1.0, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L187_C12", "label": "_dispatch()", "type": "expression", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8", "vector": [8, 3, 0.2174, 0.0012, 3, 0.49, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "label": "if", "type": "if", "loc": [188, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [4, 2, 0.2209, 0.0058, 2, 0.94, 0.7143, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.star_args:\n if comma: self._write(\", \")\n else: comma = True\n self._write(\"*\")\n self._dispatch(t.star_args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12", "label": "if", "type": "if", "loc": [189, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "vector": [4, 3, 0.2203, 0.0023, 3, 0.29, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comma: self._write(\", \")\n else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L189_C22", "label": "_write()", "type": "expression", "loc": [189, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12", "vector": [8, 4, 0.2198, 0.0012, 4, 0.04, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " if comma: self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L190_C18", "label": "comma =", "type": "assigned_variable", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12", "vector": [14, 4, 0.2209, 0.0012, 4, 0.04, 1.0, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L191_C12", "label": "_write()", "type": "expression", "loc": [191, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "vector": [8, 3, 0.2221, 0.0012, 3, 0.29, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"*\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L192_C12", "label": "_dispatch()", "type": "expression", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "vector": [8, 3, 0.2233, 0.0012, 3, 0.29, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.star_args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "label": "if", "type": "if", "loc": [193, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [4, 2, 0.2267, 0.0058, 2, 0.94, 0.8571, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.dstar_args:\n if comma: self._write(\", \")\n else: comma = True\n self._write(\"**\")\n self._dispatch(t.dstar_args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12", "label": "if", "type": "if", "loc": [194, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "vector": [4, 3, 0.2262, 0.0023, 3, 0.39, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comma: self._write(\", \")\n else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L194_C22", "label": "_write()", "type": "expression", "loc": [194, 194], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12", "vector": [8, 4, 0.2256, 0.0012, 4, 0.19, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " if comma: self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L195_C18", "label": "comma =", "type": "assigned_variable", "loc": [195, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12", "vector": [14, 4, 0.2267, 0.0012, 4, 0.19, 1.0, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L196_C12", "label": "_write()", "type": "expression", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "vector": [8, 3, 0.2279, 0.0012, 3, 0.39, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"**\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L197_C12", "label": "_dispatch()", "type": "expression", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "vector": [8, 3, 0.2291, 0.0012, 3, 0.39, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.dstar_args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L198_C8", "label": "_write()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "vector": [8, 2, 0.2302, 0.0012, 2, 0.94, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4", "label": "_Compare", "type": "function", "loc": [200, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2349, 0.0058, 1, 0.01, 0.3036, 899, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_Compare", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Compare(self, t):\n self._dispatch(t.expr)\n for op, expr in t.ops:\n self._write(\" \" + op + \" \")\n self._dispatch(expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L201_C8", "label": "_dispatch()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4", "vector": [8, 2, 0.2337, 0.0012, 2, 0.04, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8", "label": "for op, expr", "type": "for", "loc": [202, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4", "vector": [6, 2, 0.236, 0.0035, 2, 0.04, 1.0, 493, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "op, expr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for op, expr in t.ops:\n self._write(\" \" + op + \" \")\n self._dispatch(expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L203_C12", "label": "_write()", "type": "expression", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8", "vector": [8, 3, 0.236, 0.0012, 3, 0.65, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" \" + op + \" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L204_C12", "label": "_dispatch()", "type": "expression", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8", "vector": [8, 3, 0.2372, 0.0012, 3, 0.65, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4", "label": "_Const", "type": "function", "loc": [206, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2413, 0.0047, 1, 0.01, 0.3214, 236, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Const", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Const(self, t):\n \"\"\" A constant value such as an integer value, 3, or a string, \"hello\".\n \"\"\"\n self._dispatch(t.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L207_C8", "label": "expression", "type": "expression", "loc": [207, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4", "vector": [8, 2, 0.2413, 0.0023, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" A constant value such as an integer value, 3, or a string, \"hello\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L209_C8", "label": "_dispatch()", "type": "expression", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4", "vector": [8, 2, 0.243, 0.0012, 2, 0.6, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4", "label": "_Decorators", "type": "function", "loc": [211, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2477, 0.0058, 1, 0.01, 0.3393, 829, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Decorators", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Decorators(self, t):\n \"\"\" Handle function decorators (eg. @has_units)\n \"\"\"\n for node in t.nodes:\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L212_C8", "label": "expression", "type": "expression", "loc": [212, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4", "vector": [8, 2, 0.2471, 0.0023, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle function decorators (eg. @has_units)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L214_C8", "label": "for node", "type": "for", "loc": [214, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4", "vector": [6, 2, 0.2494, 0.0023, 2, 0.42, 1.0, 772, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in t.nodes:\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L215_C12", "label": "_dispatch()", "type": "expression", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L214_C8", "vector": [8, 3, 0.25, 0.0012, 3, 0.84, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "label": "_Dict", "type": "function", "loc": [217, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.257, 0.0105, 1, 0.01, 0.3571, 775, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "_Dict", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Dict(self, t):\n self._write(\"{\")\n for i, (k, v) in enumerate(t.items):\n self._dispatch(k)\n self._write(\": \")\n self._dispatch(v)\n if i < len(t.items)-1:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L218_C8", "label": "_write()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "vector": [8, 2, 0.2535, 0.0012, 2, 0.32, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"{\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "label": "for i", "type": "for", "loc": [219, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "vector": [6, 2, 0.2576, 0.007, 2, 0.32, 0.5, 826, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, (k, v) in enumerate(t.items):\n self._dispatch(k)\n self._write(\": \")\n self._dispatch(v)\n if i < len(t.items)-1:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L220_C12", "label": "_dispatch()", "type": "expression", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "vector": [8, 3, 0.2558, 0.0012, 3, 0.14, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L221_C12", "label": "_write()", "type": "expression", "loc": [221, 221], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "vector": [8, 3, 0.257, 0.0012, 3, 0.14, 0.3333, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\": \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L222_C12", "label": "_dispatch()", "type": "expression", "loc": [222, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "vector": [8, 3, 0.2581, 0.0012, 3, 0.14, 0.6667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L223_C12", "label": "if", "type": "if", "loc": [223, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "vector": [4, 3, 0.2599, 0.0023, 3, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < len(t.items)-1:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L224_C16", "label": "_write()", "type": "expression", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L223_C12", "vector": [8, 4, 0.2605, 0.0012, 4, 0.13, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L225_C8", "label": "_write()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "vector": [8, 2, 0.2616, 0.0012, 2, 0.32, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "label": "_Discard", "type": "function", "loc": [227, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2663, 0.0058, 1, 0.01, 0.375, 829, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_Discard", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Discard(self, t):\n \"\"\" Node for when return value is ignored such as in \"foo(a)\".\n \"\"\"\n self._fill()\n self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L228_C8", "label": "expression", "type": "expression", "loc": [228, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "vector": [8, 2, 0.2657, 0.0023, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Node for when return value is ignored such as in \"foo(a)\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L230_C8", "label": "_fill()", "type": "expression", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "vector": [8, 2, 0.2674, 0.0012, 2, 0.28, 0.5, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L231_C8", "label": "_dispatch()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "vector": [8, 2, 0.2686, 0.0012, 2, 0.28, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L233_C4", "label": "_Div", "type": "function", "loc": [233, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2715, 0.0023, 1, 0.01, 0.3929, 79, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Div", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Div(self, t):\n self.__binary_op(t, '/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L234_C8", "label": "__binary_op()", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L233_C4", "vector": [8, 2, 0.2721, 0.0012, 2, 0.98, 0.0, 413, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__binary_op", "arg_names": [], "import_names": [], "rhs_call_name": "__binary_op", "annotation": ""}, "snippet": " self.__binary_op(t, '/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L236_C4", "label": "_Ellipsis", "type": "function", "loc": [236, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.275, 0.0023, 1, 0.01, 0.4107, 928, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Ellipsis", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Ellipsis(self, t):\n self._write(\"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L237_C8", "label": "_write()", "type": "expression", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L236_C4", "vector": [8, 2, 0.2756, 0.0012, 2, 0.03, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "label": "_From", "type": "function", "loc": [239, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.2849, 0.0151, 1, 0.01, 0.4286, 294, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "_From", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _From(self, t):\n \"\"\" Handle \"from xyz import foo, bar as baz\".\n \"\"\"\n # fixme: Are From and ImportFrom handled differently?\n self._fill(\"from \")\n self._write(t.modname)\n self._write(\" import \")\n for i, (name,asname) in enumerate(t.names):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L240_C8", "label": "expression", "type": "expression", "loc": [240, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "vector": [8, 2, 0.2797, 0.0023, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle \"from xyz import foo, bar as baz\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L243_C8", "label": "_fill()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "vector": [8, 2, 0.2826, 0.0012, 2, 0.56, 0.25, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"from \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L244_C8", "label": "_write()", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "vector": [8, 2, 0.2837, 0.0012, 2, 0.56, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(t.modname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L245_C8", "label": "_write()", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "vector": [8, 2, 0.2849, 0.0012, 2, 0.56, 0.75, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" import \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "label": "for i", "type": "for", "loc": [246, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "vector": [6, 2, 0.289, 0.007, 2, 0.56, 1.0, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, (name,asname) in enumerate(t.names):\n if i != 0:\n self._write(\", \")\n self._write(name)\n if asname is not None:\n self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L247_C12", "label": "if", "type": "if", "loc": [247, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "vector": [4, 3, 0.2878, 0.0023, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != 0:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L248_C16", "label": "_write()", "type": "expression", "loc": [248, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L247_C12", "vector": [8, 4, 0.2884, 0.0012, 4, 0.52, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L249_C12", "label": "_write()", "type": "expression", "loc": [249, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "vector": [8, 3, 0.2895, 0.0012, 3, 0.73, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L250_C12", "label": "if", "type": "if", "loc": [250, 251], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "vector": [4, 3, 0.2913, 0.0023, 3, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if asname is not None:\n self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L251_C16", "label": "_write()", "type": "expression", "loc": [251, 251], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L250_C12", "vector": [8, 4, 0.2919, 0.0012, 4, 0.6, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "label": "_Function", "type": "function", "loc": [253, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3064, 0.0256, 1, 0.01, 0.4464, 986, 0, 2, 0, 0, 0, 0, 17], "semantic": {"name": "_Function", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Function(self, t):\n \"\"\" Handle function definitions\n \"\"\"\n if t.decorators is not None:\n self._fill(\"@\")\n self._dispatch(t.decorators)\n self._fill(\"def \"+t.name + \"(\")\n defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L254_C8", "label": "expression", "type": "expression", "loc": [254, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.2959, 0.0023, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle function definitions\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8", "label": "if", "type": "if", "loc": [256, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [4, 2, 0.2988, 0.0035, 2, 0.99, 0.1, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.decorators is not None:\n self._fill(\"@\")\n self._dispatch(t.decorators)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L257_C12", "label": "_fill()", "type": "expression", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8", "vector": [8, 3, 0.2988, 0.0012, 3, 0.63, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"@\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L258_C12", "label": "_dispatch()", "type": "expression", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8", "vector": [8, 3, 0.3, 0.0012, 3, 0.63, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.decorators)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L259_C8", "label": "_fill()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.3012, 0.0012, 2, 0.99, 0.2, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"def \"+t.name + \"(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L260_C8", "label": "defaults =", "type": "assigned_variable", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [14, 2, 0.3023, 0.0012, 2, 0.99, 0.3, 233, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "defaults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "label": "for i, arg", "type": "for", "loc": [261, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [6, 2, 0.307, 0.0081, 2, 0.99, 0.4, 281, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i, arg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, arg in enumerate(zip(t.argnames, defaults)):\n self._write(arg[0])\n if arg[1] is not None:\n self._write('=')\n self._dispatch(arg[1])\n if i < len(t.argnames)-1:\n self._write(', ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L262_C12", "label": "_write()", "type": "expression", "loc": [262, 262], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "vector": [8, 3, 0.3047, 0.0012, 3, 0.0, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(arg[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12", "label": "if", "type": "if", "loc": [263, 265], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "vector": [4, 3, 0.307, 0.0035, 3, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if arg[1] is not None:\n self._write('=')\n self._dispatch(arg[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L264_C16", "label": "_write()", "type": "expression", "loc": [264, 264], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12", "vector": [8, 4, 0.307, 0.0012, 4, 0.16, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L265_C16", "label": "_dispatch()", "type": "expression", "loc": [265, 265], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12", "vector": [8, 4, 0.3081, 0.0012, 4, 0.16, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(arg[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L266_C12", "label": "if", "type": "if", "loc": [266, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "vector": [4, 3, 0.3099, 0.0023, 3, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < len(t.argnames)-1:\n self._write(', ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L267_C16", "label": "_write()", "type": "expression", "loc": [267, 267], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L266_C12", "vector": [8, 4, 0.3105, 0.0012, 4, 0.31, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(', ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L268_C8", "label": "_write()", "type": "expression", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.3116, 0.0012, 2, 0.99, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L269_C8", "label": "if", "type": "if", "loc": [269, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [4, 2, 0.3134, 0.0023, 2, 0.99, 0.6, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._single_func:\n self._do_indent = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L270_C12", "label": "self._do_indent =", "type": "assigned_variable", "loc": [270, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L269_C8", "vector": [14, 3, 0.314, 0.0012, 3, 0.64, 0.0, 11, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._do_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._do_indent = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L271_C8", "label": "_enter()", "type": "expression", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.3151, 0.0012, 2, 0.99, 0.7, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L272_C8", "label": "_dispatch()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.3163, 0.0012, 2, 0.99, 0.8, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L273_C8", "label": "_leave()", "type": "expression", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [8, 2, 0.3174, 0.0012, 2, 0.99, 0.9, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L274_C8", "label": "self._do_indent =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "vector": [14, 2, 0.3186, 0.0012, 2, 0.99, 1.0, 11, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._do_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._do_indent = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "label": "_Getattr", "type": "function", "loc": [276, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3267, 0.0128, 1, 0.01, 0.4643, 700, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Getattr", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Getattr(self, t):\n \"\"\" Handle getting an attribute of an object\n \"\"\"\n if isinstance(t.expr, (Div, Mul, Sub, Add)):\n self._write('(')\n self._dispatch(t.expr)\n self._write(')')\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L277_C8", "label": "expression", "type": "expression", "loc": [277, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "vector": [8, 2, 0.3227, 0.0023, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle getting an attribute of an object\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "label": "if", "type": "if", "loc": [279, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "vector": [4, 2, 0.3273, 0.007, 2, 0.28, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(t.expr, (Div, Mul, Sub, Add)):\n self._write('(')\n self._dispatch(t.expr)\n self._write(')')\n else:\n self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L280_C12", "label": "_write()", "type": "expression", "loc": [280, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "vector": [8, 3, 0.3256, 0.0012, 3, 0.53, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('(')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L281_C12", "label": "_dispatch()", "type": "expression", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "vector": [8, 3, 0.3267, 0.0012, 3, 0.53, 0.3333, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L282_C12", "label": "_write()", "type": "expression", "loc": [282, 282], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "vector": [8, 3, 0.3279, 0.0012, 3, 0.53, 0.6667, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L284_C12", "label": "_dispatch()", "type": "expression", "loc": [284, 284], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "vector": [8, 3, 0.3302, 0.0012, 3, 0.53, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L286_C8", "label": "_write()", "type": "expression", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "vector": [8, 2, 0.3326, 0.0012, 2, 0.28, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('.'+t.attrname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "label": "_If", "type": "function", "loc": [288, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3471, 0.0256, 1, 0.01, 0.4821, 663, 0, 2, 0, 0, 0, 0, 16], "semantic": {"name": "_If", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _If(self, t):\n self._fill()\n \n for i, (compare,code) in enumerate(t.tests):\n if i == 0:\n self._write(\"if \")\n else:\n self._write(\"elif \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L289_C8", "label": "_fill()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "vector": [8, 2, 0.336, 0.0012, 2, 0.03, 0.0, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "label": "for i", "type": "for", "loc": [291, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "vector": [6, 2, 0.3442, 0.0128, 2, 0.03, 0.5, 826, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, (compare,code) in enumerate(t.tests):\n if i == 0:\n self._write(\"if \")\n else:\n self._write(\"elif \")\n self._dispatch(compare)\n self._enter()\n self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12", "label": "if", "type": "if", "loc": [292, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [4, 3, 0.3413, 0.0047, 3, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == 0:\n self._write(\"if \")\n else:\n self._write(\"elif \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L293_C16", "label": "_write()", "type": "expression", "loc": [293, 293], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12", "vector": [8, 4, 0.3407, 0.0012, 4, 0.73, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"if \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L295_C16", "label": "_write()", "type": "expression", "loc": [295, 295], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12", "vector": [8, 4, 0.343, 0.0012, 4, 0.73, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"elif \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L296_C12", "label": "_dispatch()", "type": "expression", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.3442, 0.0012, 3, 0.23, 0.1667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(compare)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L297_C12", "label": "_enter()", "type": "expression", "loc": [297, 297], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.3453, 0.0012, 3, 0.23, 0.3333, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L298_C12", "label": "_fill()", "type": "expression", "loc": [298, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.3465, 0.0012, 3, 0.23, 0.5, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L299_C12", "label": "_dispatch()", "type": "expression", "loc": [299, 299], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.3477, 0.0012, 3, 0.23, 0.6667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L300_C12", "label": "_leave()", "type": "expression", "loc": [300, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.3488, 0.0012, 3, 0.23, 0.8333, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L301_C12", "label": "_write()", "type": "expression", "loc": [301, 301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "vector": [8, 3, 0.35, 0.0012, 3, 0.23, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "label": "if", "type": "if", "loc": [303, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "vector": [4, 2, 0.3558, 0.0081, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.else_ is not None:\n self._write(\"else\")\n self._enter()\n self._fill()\n self._dispatch(t.else_)\n self._leave()\n self._write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L304_C12", "label": "_write()", "type": "expression", "loc": [304, 304], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.3535, 0.0012, 3, 0.85, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"else\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L305_C12", "label": "_enter()", "type": "expression", "loc": [305, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.3547, 0.0012, 3, 0.85, 0.2, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L306_C12", "label": "_fill()", "type": "expression", "loc": [306, 306], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.3558, 0.0012, 3, 0.85, 0.4, 754, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L307_C12", "label": "_dispatch()", "type": "expression", "loc": [307, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.357, 0.0012, 3, 0.85, 0.6, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.else_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L308_C12", "label": "_leave()", "type": "expression", "loc": [308, 308], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.3581, 0.0012, 3, 0.85, 0.8, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L309_C12", "label": "_write()", "type": "expression", "loc": [309, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "vector": [8, 3, 0.3593, 0.0012, 3, 0.85, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "label": "_IfExp", "type": "function", "loc": [311, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3663, 0.0105, 1, 0.01, 0.5, 422, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_IfExp", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _IfExp(self, t):\n self._dispatch(t.then)\n self._write(\" if \")\n self._dispatch(t.test)\n\n if t.else_ is not None:\n self._write(\" else (\")\n self._dispatch(t.else_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L312_C8", "label": "_dispatch()", "type": "expression", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "vector": [8, 2, 0.3628, 0.0012, 2, 0.31, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.then)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L313_C8", "label": "_write()", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "vector": [8, 2, 0.364, 0.0012, 2, 0.31, 0.3333, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" if \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L314_C8", "label": "_dispatch()", "type": "expression", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "vector": [8, 2, 0.3651, 0.0012, 2, 0.31, 0.6667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "label": "if", "type": "if", "loc": [316, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "vector": [4, 2, 0.3692, 0.0047, 2, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.else_ is not None:\n self._write(\" else (\")\n self._dispatch(t.else_)\n self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L317_C12", "label": "_write()", "type": "expression", "loc": [317, 317], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "vector": [8, 3, 0.3686, 0.0012, 3, 0.73, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" else (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L318_C12", "label": "_dispatch()", "type": "expression", "loc": [318, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "vector": [8, 3, 0.3698, 0.0012, 3, 0.73, 0.5, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.else_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L319_C12", "label": "_write()", "type": "expression", "loc": [319, 319], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "vector": [8, 3, 0.3709, 0.0012, 3, 0.73, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "label": "_Import", "type": "function", "loc": [321, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3791, 0.0128, 1, 0.01, 0.5179, 472, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "_Import", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Import(self, t):\n \"\"\" Handle \"import xyz.foo\".\n \"\"\"\n self._fill(\"import \")\n \n for i, (name,asname) in enumerate(t.names):\n if i != 0:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "vector": [8, 2, 0.375, 0.0023, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Handle \"import xyz.foo\".\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L324_C8", "label": "_fill()", "type": "expression", "loc": [324, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "vector": [8, 2, 0.3767, 0.0012, 2, 0.05, 0.5, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"import \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "label": "for i", "type": "for", "loc": [326, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "vector": [6, 2, 0.382, 0.007, 2, 0.05, 1.0, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, (name,asname) in enumerate(t.names):\n if i != 0:\n self._write(\", \")\n self._write(name)\n if asname is not None:\n self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L327_C12", "label": "if", "type": "if", "loc": [327, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "vector": [4, 3, 0.3808, 0.0023, 3, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != 0:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L328_C16", "label": "_write()", "type": "expression", "loc": [328, 328], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L327_C12", "vector": [8, 4, 0.3814, 0.0012, 4, 0.52, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L329_C12", "label": "_write()", "type": "expression", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "vector": [8, 3, 0.3826, 0.0012, 3, 0.03, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L330_C12", "label": "if", "type": "if", "loc": [330, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "vector": [4, 3, 0.3843, 0.0023, 3, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if asname is not None:\n self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L331_C16", "label": "_write()", "type": "expression", "loc": [331, 331], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L330_C12", "vector": [8, 4, 0.3849, 0.0012, 4, 0.52, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" as \"+asname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "label": "_Keyword", "type": "function", "loc": [333, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3901, 0.007, 1, 0.01, 0.5357, 564, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_Keyword", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Keyword(self, t):\n \"\"\" Keyword value assignment within function calls and definitions.\n \"\"\"\n self._write(t.name)\n self._write(\"=\")\n self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L334_C8", "label": "expression", "type": "expression", "loc": [334, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "vector": [8, 2, 0.389, 0.0023, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Keyword value assignment within function calls and definitions.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L336_C8", "label": "_write()", "type": "expression", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "vector": [8, 2, 0.3907, 0.0012, 2, 0.17, 0.3333, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(t.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L337_C8", "label": "_write()", "type": "expression", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "vector": [8, 2, 0.3919, 0.0012, 2, 0.17, 0.6667, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"=\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L338_C8", "label": "_dispatch()", "type": "expression", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "vector": [8, 2, 0.393, 0.0012, 2, 0.17, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "label": "_List", "type": "function", "loc": [340, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.3988, 0.0081, 1, 0.01, 0.5536, 973, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_List", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _List(self, t):\n self._write(\"[\")\n for i,node in enumerate(t.nodes):\n self._dispatch(node)\n if i < len(t.nodes)-1:\n self._write(\", \")\n self._write(\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L341_C8", "label": "_write()", "type": "expression", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "vector": [8, 2, 0.3965, 0.0012, 2, 0.73, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"[\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8", "label": "for i, node", "type": "for", "loc": [342, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "vector": [6, 2, 0.3994, 0.0047, 2, 0.73, 0.5, 483, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i,node in enumerate(t.nodes):\n self._dispatch(node)\n if i < len(t.nodes)-1:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L343_C12", "label": "_dispatch()", "type": "expression", "loc": [343, 343], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8", "vector": [8, 3, 0.3988, 0.0012, 3, 0.38, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L344_C12", "label": "if", "type": "if", "loc": [344, 345], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8", "vector": [4, 3, 0.4006, 0.0023, 3, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < len(t.nodes)-1:\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L345_C16", "label": "_write()", "type": "expression", "loc": [345, 345], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L344_C12", "vector": [8, 4, 0.4012, 0.0012, 4, 0.08, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L346_C8", "label": "_write()", "type": "expression", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "vector": [8, 2, 0.4023, 0.0012, 2, 0.73, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4", "label": "_Module", "type": "function", "loc": [348, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4064, 0.0047, 1, 0.01, 0.5714, 706, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_Module", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Module(self, t):\n if t.doc is not None:\n self._dispatch(t.doc)\n self._dispatch(t.node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L349_C8", "label": "if", "type": "if", "loc": [349, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4", "vector": [4, 2, 0.4064, 0.0023, 2, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.doc is not None:\n self._dispatch(t.doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L350_C12", "label": "_dispatch()", "type": "expression", "loc": [350, 350], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L349_C8", "vector": [8, 3, 0.407, 0.0012, 3, 0.43, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L351_C8", "label": "_dispatch()", "type": "expression", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4", "vector": [8, 2, 0.4081, 0.0012, 2, 0.13, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L353_C4", "label": "_Mul", "type": "function", "loc": [353, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.411, 0.0023, 1, 0.01, 0.5893, 456, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Mul", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Mul(self, t):\n self.__binary_op(t, '*')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L354_C8", "label": "__binary_op()", "type": "expression", "loc": [354, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L353_C4", "vector": [8, 2, 0.4116, 0.0012, 2, 0.03, 0.0, 413, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__binary_op", "arg_names": [], "import_names": [], "rhs_call_name": "__binary_op", "annotation": ""}, "snippet": " self.__binary_op(t, '*')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L356_C4", "label": "_Name", "type": "function", "loc": [356, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4145, 0.0023, 1, 0.01, 0.6071, 27, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Name", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Name(self, t):\n self._write(t.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L357_C8", "label": "_write()", "type": "expression", "loc": [357, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L356_C4", "vector": [8, 2, 0.4151, 0.0012, 2, 0.28, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(t.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L359_C4", "label": "_NoneType", "type": "function", "loc": [359, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.418, 0.0023, 1, 0.01, 0.625, 929, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_NoneType", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _NoneType(self, t):\n self._write(\"None\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L360_C8", "label": "_write()", "type": "expression", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L359_C4", "vector": [8, 2, 0.4186, 0.0012, 2, 0.6, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"None\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "label": "_Not", "type": "function", "loc": [362, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4227, 0.0047, 1, 0.01, 0.6429, 226, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_Not", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Not(self, t):\n self._write('not (')\n self._dispatch(t.expr)\n self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L363_C8", "label": "_write()", "type": "expression", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "vector": [8, 2, 0.4221, 0.0012, 2, 0.98, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('not (')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L364_C8", "label": "_dispatch()", "type": "expression", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "vector": [8, 2, 0.4233, 0.0012, 2, 0.98, 0.5, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L365_C8", "label": "_write()", "type": "expression", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "vector": [8, 2, 0.4244, 0.0012, 2, 0.98, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "label": "_Or", "type": "function", "loc": [367, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4302, 0.0081, 1, 0.01, 0.6607, 880, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Or", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Or(self, t):\n self._write(\" (\")\n for i, node in enumerate(t.nodes):\n self._dispatch(node)\n if i != len(t.nodes)-1:\n self._write(\") or (\")\n self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L368_C8", "label": "_write()", "type": "expression", "loc": [368, 368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "vector": [8, 2, 0.4279, 0.0012, 2, 0.61, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\" (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8", "label": "for i, node", "type": "for", "loc": [369, 372], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "vector": [6, 2, 0.4308, 0.0047, 2, 0.61, 0.5, 483, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, node in enumerate(t.nodes):\n self._dispatch(node)\n if i != len(t.nodes)-1:\n self._write(\") or (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L370_C12", "label": "_dispatch()", "type": "expression", "loc": [370, 370], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8", "vector": [8, 3, 0.4302, 0.0012, 3, 0.03, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L371_C12", "label": "if", "type": "if", "loc": [371, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8", "vector": [4, 3, 0.432, 0.0023, 3, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != len(t.nodes)-1:\n self._write(\") or (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L372_C16", "label": "_write()", "type": "expression", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L371_C12", "vector": [8, 4, 0.4326, 0.0012, 4, 0.61, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\") or (\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L373_C8", "label": "_write()", "type": "expression", "loc": [373, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "vector": [8, 2, 0.4337, 0.0012, 2, 0.61, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L375_C4", "label": "_Pass", "type": "function", "loc": [375, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4366, 0.0023, 1, 0.01, 0.6786, 499, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Pass", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Pass(self, t):\n self._write(\"pass\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L376_C8", "label": "_write()", "type": "expression", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L375_C4", "vector": [8, 2, 0.4372, 0.0012, 2, 0.63, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"pass\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "label": "_Printnl", "type": "function", "loc": [378, 388], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4453, 0.0128, 1, 0.01, 0.6964, 935, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Printnl", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Printnl(self, t):\n self._fill(\"print \")\n if t.dest:\n self._write(\">> \")\n self._dispatch(t.dest)\n self._write(\", \")\n comma = False\n for node in t.nodes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L379_C8", "label": "_fill()", "type": "expression", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "vector": [8, 2, 0.4407, 0.0012, 2, 0.39, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"print \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "label": "if", "type": "if", "loc": [380, 383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "vector": [4, 2, 0.4436, 0.0047, 2, 0.39, 0.3333, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.dest:\n self._write(\">> \")\n self._dispatch(t.dest)\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L381_C12", "label": "_write()", "type": "expression", "loc": [381, 381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "vector": [8, 3, 0.443, 0.0012, 3, 0.01, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\">> \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L382_C12", "label": "_dispatch()", "type": "expression", "loc": [382, 382], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "vector": [8, 3, 0.4442, 0.0012, 3, 0.01, 0.5, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.dest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L383_C12", "label": "_write()", "type": "expression", "loc": [383, 383], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "vector": [8, 3, 0.4453, 0.0012, 3, 0.01, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L384_C8", "label": "comma =", "type": "assigned_variable", "loc": [384, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "vector": [14, 2, 0.4465, 0.0012, 2, 0.39, 0.6667, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comma = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8", "label": "for node", "type": "for", "loc": [385, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "vector": [6, 2, 0.4494, 0.0047, 2, 0.39, 1.0, 772, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in t.nodes:\n if comma: self._write(', ')\n else: comma = True\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12", "label": "if", "type": "if", "loc": [386, 387], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8", "vector": [4, 3, 0.4494, 0.0023, 3, 0.01, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comma: self._write(', ')\n else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L386_C22", "label": "_write()", "type": "expression", "loc": [386, 386], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12", "vector": [8, 4, 0.4488, 0.0012, 4, 0.01, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " if comma: self._write(', ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L387_C18", "label": "comma =", "type": "assigned_variable", "loc": [387, 387], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12", "vector": [14, 4, 0.45, 0.0012, 4, 0.01, 1.0, 55, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "comma", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: comma = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L388_C12", "label": "_dispatch()", "type": "expression", "loc": [388, 388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8", "vector": [8, 3, 0.4512, 0.0012, 3, 0.01, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L390_C4", "label": "_Power", "type": "function", "loc": [390, 391], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4541, 0.0023, 1, 0.01, 0.7143, 135, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Power", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Power(self, t):\n self.__binary_op(t, '**')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L391_C8", "label": "__binary_op()", "type": "expression", "loc": [391, 391], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L390_C4", "vector": [8, 2, 0.4547, 0.0012, 2, 0.39, 0.0, 413, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__binary_op", "arg_names": [], "import_names": [], "rhs_call_name": "__binary_op", "annotation": ""}, "snippet": " self.__binary_op(t, '**')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4", "label": "_Return", "type": "function", "loc": [393, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4622, 0.0116, 1, 0.01, 0.7321, 696, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "_Return", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Return(self, t):\n self._fill(\"return \")\n if t.value:\n if isinstance(t.value, Tuple):\n text = ', '.join([ name.name for name in t.value.asList() ])\n self._write(text)\n else:\n self._dispatch(t.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L394_C8", "label": "_fill()", "type": "expression", "loc": [394, 394], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4", "vector": [8, 2, 0.4581, 0.0012, 2, 0.65, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"return \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8", "label": "if", "type": "if", "loc": [395, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4", "vector": [4, 2, 0.4634, 0.0093, 2, 0.65, 1.0, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.value:\n if isinstance(t.value, Tuple):\n text = ', '.join([ name.name for name in t.value.asList() ])\n self._write(text)\n else:\n self._dispatch(t.value)\n if not self._do_indent:\n self._write('; ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "label": "if", "type": "if", "loc": [396, 400], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8", "vector": [4, 3, 0.4628, 0.0058, 3, 0.81, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(t.value, Tuple):\n text = ', '.join([ name.name for name in t.value.asList() ])\n self._write(text)\n else:\n self._dispatch(t.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L397_C16", "label": "text = join()", "type": "assigned_variable", "loc": [397, 397], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "vector": [14, 4, 0.4616, 0.0012, 4, 0.64, 0.0, 439, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " text = ', '.join([ name.name for name in t.value.asList() ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L398_C16", "label": "_write()", "type": "expression", "loc": [398, 398], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "vector": [8, 4, 0.4628, 0.0012, 4, 0.64, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L400_C16", "label": "_dispatch()", "type": "expression", "loc": [400, 400], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "vector": [8, 4, 0.4651, 0.0012, 4, 0.64, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L401_C12", "label": "if", "type": "if", "loc": [401, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8", "vector": [4, 3, 0.4669, 0.0023, 3, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._do_indent:\n self._write('; ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L402_C16", "label": "_write()", "type": "expression", "loc": [402, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L401_C12", "vector": [8, 4, 0.4674, 0.0012, 4, 0.67, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('; ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "label": "_Slice", "type": "function", "loc": [404, 415], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4762, 0.014, 1, 0.01, 0.75, 820, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Slice", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Slice(self, t):\n self._dispatch(t.expr)\n self._write(\"[\")\n if t.lower:\n self._dispatch(t.lower)\n self._write(\":\")\n if t.upper:\n self._dispatch(t.upper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L405_C8", "label": "_dispatch()", "type": "expression", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [8, 2, 0.4709, 0.0012, 2, 0.37, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L406_C8", "label": "_write()", "type": "expression", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [8, 2, 0.4721, 0.0012, 2, 0.37, 0.2, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"[\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L407_C8", "label": "if", "type": "if", "loc": [407, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [4, 2, 0.4738, 0.0023, 2, 0.37, 0.4, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.lower:\n self._dispatch(t.lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L408_C12", "label": "_dispatch()", "type": "expression", "loc": [408, 408], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L407_C8", "vector": [8, 3, 0.4744, 0.0012, 3, 0.52, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L409_C8", "label": "_write()", "type": "expression", "loc": [409, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [8, 2, 0.4756, 0.0012, 2, 0.37, 0.6, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\":\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L410_C8", "label": "if", "type": "if", "loc": [410, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [4, 2, 0.4773, 0.0023, 2, 0.37, 0.8, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.upper:\n self._dispatch(t.upper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L411_C12", "label": "_dispatch()", "type": "expression", "loc": [411, 411], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L410_C8", "vector": [8, 3, 0.4779, 0.0012, 3, 0.81, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.upper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L415_C8", "label": "_write()", "type": "expression", "loc": [415, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "vector": [8, 2, 0.4826, 0.0012, 2, 0.37, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L417_C4", "label": "_Sliceobj", "type": "function", "loc": [417, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4878, 0.007, 1, 0.01, 0.7679, 759, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "_Sliceobj", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Sliceobj(self, t):\n for i, node in enumerate(t.nodes):\n if i != 0:\n self._write(\":\")\n if not (isinstance(node, Const) and node.value is None):\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8", "label": "for i, node", "type": "for", "loc": [418, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L417_C4", "vector": [6, 2, 0.4884, 0.0058, 2, 0.01, 0.0, 483, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, node in enumerate(t.nodes):\n if i != 0:\n self._write(\":\")\n if not (isinstance(node, Const) and node.value is None):\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L419_C12", "label": "if", "type": "if", "loc": [419, 420], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8", "vector": [4, 3, 0.4878, 0.0023, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != 0:\n self._write(\":\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L420_C16", "label": "_write()", "type": "expression", "loc": [420, 420], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L419_C12", "vector": [8, 4, 0.4884, 0.0012, 4, 0.5, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\":\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L421_C12", "label": "if", "type": "if", "loc": [421, 422], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8", "vector": [4, 3, 0.4901, 0.0023, 3, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (isinstance(node, Const) and node.value is None):\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L422_C16", "label": "_dispatch()", "type": "expression", "loc": [422, 422], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L421_C12", "vector": [8, 4, 0.4907, 0.0012, 4, 0.71, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L424_C4", "label": "_Stmt", "type": "function", "loc": [424, 426], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4942, 0.0035, 1, 0.01, 0.7857, 891, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Stmt", "arg_names": ["self", "tree"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Stmt(self, tree):\n for node in tree.nodes:\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L425_C8", "label": "for node", "type": "for", "loc": [425, 426], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L424_C4", "vector": [6, 2, 0.4948, 0.0023, 2, 0.67, 0.0, 772, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in tree.nodes:\n self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L426_C12", "label": "_dispatch()", "type": "expression", "loc": [426, 426], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L425_C8", "vector": [8, 3, 0.4953, 0.0012, 3, 0.14, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L428_C4", "label": "_Sub", "type": "function", "loc": [428, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.4983, 0.0023, 1, 0.01, 0.8036, 680, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_Sub", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Sub(self, t):\n self.__binary_op(t, '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L429_C8", "label": "__binary_op()", "type": "expression", "loc": [429, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L428_C4", "vector": [8, 2, 0.4988, 0.0012, 2, 0.11, 0.0, 413, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__binary_op", "arg_names": [], "import_names": [], "rhs_call_name": "__binary_op", "annotation": ""}, "snippet": " self.__binary_op(t, '-')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "label": "_Subscript", "type": "function", "loc": [431, 438], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5052, 0.0093, 1, 0.01, 0.8214, 231, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Subscript", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Subscript(self, t):\n self._dispatch(t.expr)\n self._write(\"[\")\n for i, value in enumerate(t.subs):\n if i != 0:\n self._write(\",\")\n self._dispatch(value)\n self._write(\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L432_C8", "label": "_dispatch()", "type": "expression", "loc": [432, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "vector": [8, 2, 0.5023, 0.0012, 2, 0.28, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L433_C8", "label": "_write()", "type": "expression", "loc": [433, 433], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "vector": [8, 2, 0.5035, 0.0012, 2, 0.28, 0.3333, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"[\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8", "label": "for i, value", "type": "for", "loc": [434, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "vector": [6, 2, 0.5064, 0.0047, 2, 0.28, 0.6667, 473, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, value in enumerate(t.subs):\n if i != 0:\n self._write(\",\")\n self._dispatch(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L435_C12", "label": "if", "type": "if", "loc": [435, 436], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8", "vector": [4, 3, 0.5064, 0.0023, 3, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i != 0:\n self._write(\",\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L436_C16", "label": "_write()", "type": "expression", "loc": [436, 436], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L435_C12", "vector": [8, 4, 0.507, 0.0012, 4, 0.39, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\",\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L437_C12", "label": "_dispatch()", "type": "expression", "loc": [437, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8", "vector": [8, 3, 0.5081, 0.0012, 3, 0.74, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L438_C8", "label": "_write()", "type": "expression", "loc": [438, 438], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "vector": [8, 2, 0.5093, 0.0012, 2, 0.28, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "label": "_TryExcept", "type": "function", "loc": [440, 460], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5233, 0.0244, 1, 0.01, 0.8393, 699, 0, 2, 0, 0, 0, 0, 15], "semantic": {"name": "_TryExcept", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _TryExcept(self, t):\n self._fill(\"try\")\n self._enter()\n self._dispatch(t.body)\n self._leave()\n\n for handler in t.handlers:\n self._fill('except ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L441_C8", "label": "_fill()", "type": "expression", "loc": [441, 441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [8, 2, 0.5128, 0.0012, 2, 0.49, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"try\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L442_C8", "label": "_enter()", "type": "expression", "loc": [442, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [8, 2, 0.514, 0.0012, 2, 0.49, 0.2, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L443_C8", "label": "_dispatch()", "type": "expression", "loc": [443, 443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [8, 2, 0.5151, 0.0012, 2, 0.49, 0.4, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L444_C8", "label": "_leave()", "type": "expression", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [8, 2, 0.5163, 0.0012, 2, 0.49, 0.6, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "label": "for handler", "type": "for", "loc": [446, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [6, 2, 0.5233, 0.0105, 2, 0.49, 0.8, 388, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for handler in t.handlers:\n self._fill('except ')\n self._dispatch(handler[0])\n if handler[1] is not None:\n self._write(', ')\n self._dispatch(handler[1])\n self._enter()\n self._dispatch(handler[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L447_C12", "label": "_fill()", "type": "expression", "loc": [447, 447], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [8, 3, 0.5198, 0.0012, 3, 0.87, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill('except ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L448_C12", "label": "_dispatch()", "type": "expression", "loc": [448, 448], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [8, 3, 0.5209, 0.0012, 3, 0.87, 0.2, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(handler[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12", "label": "if", "type": "if", "loc": [449, 451], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [4, 3, 0.5233, 0.0035, 3, 0.87, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if handler[1] is not None:\n self._write(', ')\n self._dispatch(handler[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L450_C16", "label": "_write()", "type": "expression", "loc": [450, 450], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12", "vector": [8, 4, 0.5233, 0.0012, 4, 0.65, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(', ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L451_C16", "label": "_dispatch()", "type": "expression", "loc": [451, 451], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12", "vector": [8, 4, 0.5244, 0.0012, 4, 0.65, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(handler[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L452_C12", "label": "_enter()", "type": "expression", "loc": [452, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [8, 3, 0.5256, 0.0012, 3, 0.87, 0.6, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L453_C12", "label": "_dispatch()", "type": "expression", "loc": [453, 453], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [8, 3, 0.5267, 0.0012, 3, 0.87, 0.8, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(handler[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L454_C12", "label": "_leave()", "type": "expression", "loc": [454, 454], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "vector": [8, 3, 0.5279, 0.0012, 3, 0.87, 1.0, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "label": "if", "type": "if", "loc": [456, 460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "vector": [4, 2, 0.5326, 0.0058, 2, 0.49, 1.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.else_:\n self._fill(\"else\")\n self._enter()\n self._dispatch(t.else_)\n self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L457_C12", "label": "_fill()", "type": "expression", "loc": [457, 457], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "vector": [8, 3, 0.5314, 0.0012, 3, 0.89, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill(\"else\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L458_C12", "label": "_enter()", "type": "expression", "loc": [458, 458], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "vector": [8, 3, 0.5326, 0.0012, 3, 0.89, 0.3333, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L459_C12", "label": "_dispatch()", "type": "expression", "loc": [459, 459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "vector": [8, 3, 0.5337, 0.0012, 3, 0.89, 0.6667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.else_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L460_C12", "label": "_leave()", "type": "expression", "loc": [460, 460], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "vector": [8, 3, 0.5349, 0.0012, 3, 0.89, 1.0, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L462_C4", "label": "_Tuple", "type": "function", "loc": [462, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5471, 0.0209, 1, 0.01, 0.8571, 548, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_Tuple", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Tuple(self, t):\n\n if not t.nodes:\n # Empty tuple.\n self._write(\"()\")\n else:\n self._write(\"(\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "label": "if", "type": "if", "loc": [464, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L462_C4", "vector": [4, 2, 0.5483, 0.0186, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not t.nodes:\n # Empty tuple.\n self._write(\"()\")\n else:\n self._write(\"(\")\n\n # _write each elements, separated by a comma.\n for element in t.nodes[:-1]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L466_C12", "label": "_write()", "type": "expression", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [8, 3, 0.5419, 0.0012, 3, 0.3, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"()\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L468_C12", "label": "_write()", "type": "expression", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [8, 3, 0.5442, 0.0012, 3, 0.3, 0.2, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12", "label": "for element", "type": "for", "loc": [471, 473], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [6, 3, 0.5488, 0.0035, 3, 0.3, 0.4, 736, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for element in t.nodes[:-1]:\n self._dispatch(element)\n self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L472_C16", "label": "_dispatch()", "type": "expression", "loc": [472, 472], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12", "vector": [8, 4, 0.5488, 0.0012, 4, 0.0, 0.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L473_C16", "label": "_write()", "type": "expression", "loc": [473, 473], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12", "vector": [8, 4, 0.55, 0.0012, 4, 0.0, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\", \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L476_C12", "label": "last_element =", "type": "assigned_variable", "loc": [476, 476], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [14, 3, 0.5535, 0.0012, 3, 0.3, 0.6, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_element = t.nodes[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L477_C12", "label": "_dispatch()", "type": "expression", "loc": [477, 477], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [8, 3, 0.5547, 0.0012, 3, 0.3, 0.8, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(last_element)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L479_C12", "label": "_write()", "type": "expression", "loc": [479, 479], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "vector": [8, 3, 0.557, 0.0012, 3, 0.3, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\")\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4", "label": "_UnaryAdd", "type": "function", "loc": [481, 483], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5605, 0.0035, 1, 0.01, 0.875, 243, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_UnaryAdd", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _UnaryAdd(self, t):\n self._write(\"+\")\n self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L482_C8", "label": "_write()", "type": "expression", "loc": [482, 482], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4", "vector": [8, 2, 0.5605, 0.0012, 2, 0.1, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L483_C8", "label": "_dispatch()", "type": "expression", "loc": [483, 483], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4", "vector": [8, 2, 0.5616, 0.0012, 2, 0.1, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4", "label": "_UnarySub", "type": "function", "loc": [485, 487], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5651, 0.0035, 1, 0.01, 0.8929, 991, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_UnarySub", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _UnarySub(self, t):\n self._write(\"-\")\n self._dispatch(t.expr) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L486_C8", "label": "_write()", "type": "expression", "loc": [486, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4", "vector": [8, 2, 0.5651, 0.0012, 2, 0.56, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(\"-\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L487_C8", "label": "_dispatch()", "type": "expression", "loc": [487, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4", "vector": [8, 2, 0.5663, 0.0012, 2, 0.56, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "label": "_With", "type": "function", "loc": [489, 498], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5738, 0.0116, 1, 0.01, 0.9107, 212, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "_With", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _With(self, t):\n self._fill('with ')\n self._dispatch(t.expr)\n if t.vars:\n self._write(' as ')\n self._dispatch(t.vars.name)\n self._enter()\n self._dispatch(t.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L490_C8", "label": "_fill()", "type": "expression", "loc": [490, 490], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5698, 0.0012, 2, 0.49, 0.0, 754, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fill", "arg_names": [], "import_names": [], "rhs_call_name": "_fill", "annotation": ""}, "snippet": " self._fill('with ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L491_C8", "label": "_dispatch()", "type": "expression", "loc": [491, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5709, 0.0012, 2, 0.49, 0.1667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.expr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8", "label": "if", "type": "if", "loc": [492, 494], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [4, 2, 0.5733, 0.0035, 2, 0.49, 0.3333, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.vars:\n self._write(' as ')\n self._dispatch(t.vars.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L493_C12", "label": "_write()", "type": "expression", "loc": [493, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8", "vector": [8, 3, 0.5733, 0.0012, 3, 0.76, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(' as ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L494_C12", "label": "_dispatch()", "type": "expression", "loc": [494, 494], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8", "vector": [8, 3, 0.5744, 0.0012, 3, 0.76, 1.0, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.vars.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L495_C8", "label": "_enter()", "type": "expression", "loc": [495, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5756, 0.0012, 2, 0.49, 0.5, 922, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": [], "import_names": [], "rhs_call_name": "_enter", "annotation": ""}, "snippet": " self._enter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L496_C8", "label": "_dispatch()", "type": "expression", "loc": [496, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5767, 0.0012, 2, 0.49, 0.6667, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L497_C8", "label": "_leave()", "type": "expression", "loc": [497, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5779, 0.0012, 2, 0.49, 0.8333, 620, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": [], "import_names": [], "rhs_call_name": "_leave", "annotation": ""}, "snippet": " self._leave()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L498_C8", "label": "_write()", "type": "expression", "loc": [498, 498], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "vector": [8, 2, 0.5791, 0.0012, 2, 0.49, 1.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L500_C4", "label": "_int", "type": "function", "loc": [500, 501], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.582, 0.0023, 1, 0.01, 0.9286, 988, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_int", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _int(self, t):\n self._write(repr(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L501_C8", "label": "_write()", "type": "expression", "loc": [501, 501], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L500_C4", "vector": [8, 2, 0.5826, 0.0012, 2, 0.34, 0.0, 961, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(repr(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "label": "__binary_op", "type": "function", "loc": [503, 527], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.5988, 0.0291, 1, 0.01, 0.9464, 413, 0, 3, 0, 0, 0, 0, 13], "semantic": {"name": "__binary_op", "arg_names": ["self", "t", "symbol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __binary_op(self, t, symbol):\n # Check if parenthesis are needed on left side and then dispatch\n has_paren = False\n left_class = str(t.left.__class__)\n if (left_class in op_precedence.keys() and\n op_precedence[left_class] < op_precedence[str(t.__class__)]):\n has_paren = True\n if has_paren:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L505_C8", "label": "has_paren =", "type": "assigned_variable", "loc": [505, 505], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [14, 2, 0.5872, 0.0012, 2, 0.96, 0.0, 66, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_paren", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_paren = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L506_C8", "label": "left_class = str()", "type": "assigned_variable", "loc": [506, 506], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [14, 2, 0.5884, 0.0012, 2, 0.96, 0.0833, 139, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "left_class", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " left_class = str(t.left.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L507_C8", "label": "if", "type": "if", "loc": [507, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.5907, 0.0035, 2, 0.96, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (left_class in op_precedence.keys() and\n op_precedence[left_class] < op_precedence[str(t.__class__)]):\n has_paren = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L509_C12", "label": "has_paren =", "type": "assigned_variable", "loc": [509, 509], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L507_C8", "vector": [14, 3, 0.5919, 0.0012, 3, 0.32, 0.0, 66, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_paren", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_paren = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L510_C8", "label": "if", "type": "if", "loc": [510, 511], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.5936, 0.0023, 2, 0.96, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_paren:\n self._write('(')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L511_C12", "label": "_write()", "type": "expression", "loc": [511, 511], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L510_C8", "vector": [8, 3, 0.5942, 0.0012, 3, 0.82, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('(')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L512_C8", "label": "_dispatch()", "type": "expression", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [8, 2, 0.5953, 0.0012, 2, 0.96, 0.3333, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.left)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L513_C8", "label": "if", "type": "if", "loc": [513, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.5971, 0.0023, 2, 0.96, 0.4167, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_paren:\n self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L514_C12", "label": "_write()", "type": "expression", "loc": [514, 514], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L513_C8", "vector": [8, 3, 0.5977, 0.0012, 3, 0.32, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L516_C8", "label": "_write()", "type": "expression", "loc": [516, 516], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [8, 2, 0.6, 0.0012, 2, 0.96, 0.5, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(symbol)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L518_C8", "label": "has_paren =", "type": "assigned_variable", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [14, 2, 0.6023, 0.0012, 2, 0.96, 0.5833, 66, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_paren", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_paren = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L519_C8", "label": "right_class = str()", "type": "assigned_variable", "loc": [519, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [14, 2, 0.6035, 0.0012, 2, 0.96, 0.6667, 670, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "right_class", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " right_class = str(t.right.__class__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L520_C8", "label": "if", "type": "if", "loc": [520, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.6058, 0.0035, 2, 0.96, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (right_class in op_precedence.keys() and\n op_precedence[right_class] < op_precedence[str(t.__class__)]):\n has_paren = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L522_C12", "label": "has_paren =", "type": "assigned_variable", "loc": [522, 522], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L520_C8", "vector": [14, 3, 0.607, 0.0012, 3, 0.77, 0.0, 66, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_paren", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_paren = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L523_C8", "label": "if", "type": "if", "loc": [523, 524], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.6087, 0.0023, 2, 0.96, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_paren:\n self._write('(')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L524_C12", "label": "_write()", "type": "expression", "loc": [524, 524], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L523_C8", "vector": [8, 3, 0.6093, 0.0012, 3, 0.98, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write('(')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L525_C8", "label": "_dispatch()", "type": "expression", "loc": [525, 525], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [8, 2, 0.6105, 0.0012, 2, 0.96, 0.9167, 835, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "_dispatch", "annotation": ""}, "snippet": " self._dispatch(t.right)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:If_L526_C8", "label": "if", "type": "if", "loc": [526, 527], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "vector": [4, 2, 0.6122, 0.0023, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_paren:\n self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L527_C12", "label": "_write()", "type": "expression", "loc": [527, 527], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:If_L526_C8", "vector": [8, 3, 0.6128, 0.0012, 3, 0.68, 0.0, 961, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(')')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L529_C4", "label": "_float", "type": "function", "loc": [529, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.6169, 0.0047, 1, 0.01, 0.9643, 108, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_float", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _float(self, t):\n # if t is 0.1, str(t)->'0.1' while repr(t)->'0.1000000000001'\n # We prefer str here.\n self._write(str(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L532_C8", "label": "_write()", "type": "expression", "loc": [532, 532], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L529_C4", "vector": [8, 2, 0.6186, 0.0012, 2, 0.76, 0.0, 961, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(str(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L534_C4", "label": "_str", "type": "function", "loc": [534, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.6215, 0.0023, 1, 0.01, 0.9821, 828, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_str", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str(self, t):\n self._write(repr(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L535_C8", "label": "_write()", "type": "expression", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L534_C4", "vector": [8, 2, 0.6221, 0.0012, 2, 0.5, 0.0, 961, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(repr(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L537_C4", "label": "_tuple", "type": "function", "loc": [537, 538], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "vector": [2, 1, 0.625, 0.0023, 1, 0.01, 1.0, 639, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_tuple", "arg_names": ["self", "t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _tuple(self, t):\n self._write(str(t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L538_C8", "label": "_write()", "type": "expression", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L537_C4", "vector": [8, 2, 0.6256, 0.0012, 2, 0.02, 0.0, 961, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_write", "arg_names": [], "import_names": [], "rhs_call_name": "_write", "annotation": ""}, "snippet": " self._write(str(t))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Return_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L164_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L165_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L175_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L176_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L185_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L186_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L189_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L189_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L190_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L194_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L194_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L195_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L214_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L220_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L222_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L219_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L223_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L223_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L247_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L248_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L250_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L251_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L262_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L264_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L263_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L265_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L266_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L267_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L280_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L282_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L284_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L293_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L292_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L295_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L298_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L300_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L291_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L306_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L308_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L309_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L318_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L321_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L327_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L328_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L326_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L330_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L330_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L331_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L343_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L342_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L345_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L349_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L350_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L353_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L362_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L370_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L382_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L386_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L386_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L387_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L385_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L391_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L393_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L397_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L398_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L396_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L400_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L395_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L401_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L401_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L402_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L407_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L408_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L404_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L417_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L417_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L419_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L419_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L420_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L418_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L421_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L421_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L422_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L425_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L426_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L428_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L435_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L436_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L434_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L438_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L442_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L443_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L448_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L450_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L449_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L451_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L452_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L453_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L454_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L457_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L458_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L456_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L460_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L462_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L462_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L466_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L472_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:For_L471_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L473_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L476_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L477_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L479_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L482_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L481_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L486_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L485_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L491_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L493_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L492_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L496_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L500_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L500_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L501_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L505_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L506_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L507_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L507_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L509_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L510_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L510_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L511_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L513_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L514_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L516_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L519_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L520_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Assign_L522_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L523_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L524_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L525_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:If_L526_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:If_L526_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L527_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L529_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L529_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L532_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L537_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_761:FunctionDef_L537_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_761:Expr_L538_C8"}] |
"""
==============
phantom_import
==============
Sphinx extension to make directives from ``sphinx.ext.autodoc`` and similar
extensions to use docstrings loaded from an XML file.
This extension loads an XML file in the Pydocweb format [1] and
creates a dummy module that contains the specified docstrings. This
can be used to get the current docstrings from a Pydocweb instance
without needing to rebuild the documented module.
.. [1] http://code.google.com/p/pydocweb
"""
import imp, sys, compiler, types, os, inspect, re
def setup(app):
app.connect('builder-inited', initialize)
app.add_config_value('phantom_import_file', None, True)
def initialize(app):
fn = app.config.phantom_import_file
if (fn and os.path.isfile(fn)):
print "[numpydoc] Phantom importing modules from", fn, "..."
import_phantom_module(fn)
#------------------------------------------------------------------------------
# Creating 'phantom' modules from an XML description
#------------------------------------------------------------------------------
def import_phantom_module(xml_file):
"""
Insert a fake Python module to sys.modules, based on a XML file.
The XML file is expected to conform to Pydocweb DTD. The fake
module will contain dummy objects, which guarantee the following:
- Docstrings are correct.
- Class inheritance relationships are correct (if present in XML).
- Function argspec is *NOT* correct (even if present in XML).
Instead, the function signature is prepended to the function docstring.
- Class attributes are *NOT* correct; instead, they are dummy objects.
Parameters
----------
xml_file : str
Name of an XML file to read
"""
import lxml.etree as etree
object_cache = {}
tree = etree.parse(xml_file)
root = tree.getroot()
# Sort items so that
# - Base classes come before classes inherited from them
# - Modules come before their contents
all_nodes = dict([(n.attrib['id'], n) for n in root])
def _get_bases(node, recurse=False):
bases = [x.attrib['ref'] for x in node.findall('base')]
if recurse:
j = 0
while True:
try:
b = bases[j]
except IndexError: break
if b in all_nodes:
bases.extend(_get_bases(all_nodes[b]))
j += 1
return bases
type_index = ['module', 'class', 'callable', 'object']
def base_cmp(a, b):
x = cmp(type_index.index(a.tag), type_index.index(b.tag))
if x != 0: return x
if a.tag == 'class' and b.tag == 'class':
a_bases = _get_bases(a, recurse=True)
b_bases = _get_bases(b, recurse=True)
x = cmp(len(a_bases), len(b_bases))
if x != 0: return x
if a.attrib['id'] in b_bases: return -1
if b.attrib['id'] in a_bases: return 1
return cmp(a.attrib['id'].count('.'), b.attrib['id'].count('.'))
nodes = root.getchildren()
nodes.sort(base_cmp)
# Create phantom items
for node in nodes:
name = node.attrib['id']
doc = (node.text or '').decode('string-escape') + "\n"
if doc == "\n": doc = ""
# create parent, if missing
parent = name
while True:
parent = '.'.join(parent.split('.')[:-1])
if not parent: break
if parent in object_cache: break
obj = imp.new_module(parent)
object_cache[parent] = obj
sys.modules[parent] = obj
# create object
if node.tag == 'module':
obj = imp.new_module(name)
obj.__doc__ = doc
sys.modules[name] = obj
elif node.tag == 'class':
bases = [object_cache[b] for b in _get_bases(node)
if b in object_cache]
bases.append(object)
init = lambda self: None
init.__doc__ = doc
obj = type(name, tuple(bases), {'__doc__': doc, '__init__': init})
obj.__name__ = name.split('.')[-1]
elif node.tag == 'callable':
funcname = node.attrib['id'].split('.')[-1]
argspec = node.attrib.get('argspec')
if argspec:
argspec = re.sub('^[^(]*', '', argspec)
doc = "%s%s\n\n%s" % (funcname, argspec, doc)
obj = lambda: 0
obj.__argspec_is_invalid_ = True
obj.func_name = funcname
obj.__name__ = name
obj.__doc__ = doc
if inspect.isclass(object_cache[parent]):
obj.__objclass__ = object_cache[parent]
else:
class Dummy(object): pass
obj = Dummy()
obj.__name__ = name
obj.__doc__ = doc
if inspect.isclass(object_cache[parent]):
obj.__get__ = lambda: None
object_cache[name] = obj
if parent:
if inspect.ismodule(object_cache[parent]):
obj.__module__ = parent
setattr(object_cache[parent], name.split('.')[-1], obj)
# Populate items
for node in root:
obj = object_cache.get(node.attrib['id'])
if obj is None: continue
for ref in node.findall('ref'):
if node.tag == 'class':
if ref.attrib['ref'].startswith(node.attrib['id'] + '.'):
setattr(obj, ref.attrib['name'],
object_cache.get(ref.attrib['ref']))
else:
setattr(obj, ref.attrib['name'],
object_cache.get(ref.attrib['ref']))
| ajibawa-2023/Python-Code-Large/train/row_762 | 101 | 162 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 16], "level": 0, "parent": null, "vector": [8, 0, 0.0525, 0.0988, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n==============\nphantom_import\n==============\n\nSphinx extension to make directives from ``sphinx.ext.autodoc`` and similar\nextensions to use docstrings loaded from an XML file.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Import_L17_C0", "label": "imp import imp, sys, compiler\u2026", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1049, 0.0062, 0, 0.66, 0.25, 201, 0, 7, 0, 0, 201, 0, 0], "semantic": {"name": "imp", "arg_names": [], "import_names": ["imp", "sys", "compiler", "types", "os", "inspect", "re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import imp, sys, compiler, types, os, inspect, re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "label": "setup", "type": "function", "loc": [19, 21], "level": 0, "parent": null, "vector": [2, 0, 0.1235, 0.0185, 0, 0.66, 0.5, 234, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setup", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup(app):\n app.connect('builder-inited', initialize)\n app.add_config_value('phantom_import_file', None, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L20_C4", "label": "connect()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "vector": [8, 1, 0.1235, 0.0062, 1, 0.95, 0.0, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " app.connect('builder-inited', initialize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L21_C4", "label": "add_config_value()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "vector": [8, 1, 0.1296, 0.0062, 1, 0.95, 1.0, 532, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_config_value", "arg_names": [], "import_names": [], "rhs_call_name": "add_config_value", "annotation": ""}, "snippet": " app.add_config_value('phantom_import_file', None, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L23_C0", "label": "initialize", "type": "function", "loc": [23, 27], "level": 0, "parent": null, "vector": [2, 0, 0.1543, 0.0309, 0, 0.66, 0.75, 393, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "initialize", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def initialize(app):\n fn = app.config.phantom_import_file\n if (fn and os.path.isfile(fn)):\n print(\"[numpydoc] Phantom importing modules from\", fn, \"...\")\n import_phantom_module(fn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L24_C4", "label": "fn =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L23_C0", "vector": [14, 1, 0.1481, 0.0062, 1, 0.89, 0.0, 59, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fn = app.config.phantom_import_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4", "label": "if", "type": "if", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L23_C0", "vector": [4, 1, 0.1605, 0.0185, 1, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (fn and os.path.isfile(fn)):\n print(\"[numpydoc] Phantom importing modules from\", fn, \"...\")\n import_phantom_module(fn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L26_C8", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4", "vector": [8, 2, 0.1605, 0.0062, 2, 0.69, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"[numpydoc] Phantom importing modules from\", fn, \"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L27_C8", "label": "import_phantom_module()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4", "vector": [8, 2, 0.1667, 0.0062, 2, 0.69, 1.0, 360, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "import_phantom_module", "arg_names": [], "import_names": [], "rhs_call_name": "import_phantom_module", "annotation": ""}, "snippet": " import_phantom_module(fn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "label": "import_phantom_module", "type": "function", "loc": [32, 162], "level": 0, "parent": null, "vector": [2, 0, 0.5988, 0.8086, 0, 0.66, 1.0, 360, 0, 1, 1, 0, 0, 0, 45], "semantic": {"name": "import_phantom_module", "arg_names": ["xml_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def import_phantom_module(xml_file):\n \"\"\"\n Insert a fake Python module to sys.modules, based on a XML file.\n\n The XML file is expected to conform to Pydocweb DTD. The fake\n module will contain dummy objects, which guarantee the following:\n\n - Docstrings are correct."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L33_C4", "label": "expression", "type": "expression", "loc": [33, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [8, 1, 0.2562, 0.1111, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Insert a fake Python module to sys.modules, based on a XML file.\n\n The XML file is expected to conform to Pydocweb DTD. The fake\n module will contain dummy objects, which guarantee the following:\n\n - Docstrings are correct.\n - Class inheritance relationships are correct (if present in XML)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Import_L51_C4", "label": "lxml.etree import etree", "type": "import", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [1, 1, 0.3148, 0.0062, 1, 0.58, 0.0833, 910, 0, 1, 0, 0, 910, 0, 0], "semantic": {"name": "lxml.etree", "arg_names": [], "import_names": ["etree"], "rhs_call_name": "", "annotation": ""}, "snippet": " import lxml.etree as etree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L53_C4", "label": "object_cache =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.3272, 0.0062, 1, 0.58, 0.1667, 107, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "object_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L55_C4", "label": "tree = parse()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.3395, 0.0062, 1, 0.58, 0.25, 613, 3, 1, 0, 0, 678, 10, 1], "semantic": {"name": "tree", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " tree = etree.parse(xml_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L56_C4", "label": "root = getroot()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.3457, 0.0062, 1, 0.58, 0.3333, 696, 3, 0, 0, 0, 280, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "getroot", "annotation": ""}, "snippet": " root = tree.getroot()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L61_C4", "label": "all_nodes = dict()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.3765, 0.0062, 1, 0.58, 0.4167, 295, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "all_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " all_nodes = dict([(n.attrib['id'], n) for n in root])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "label": "_get_bases", "type": "function", "loc": [63, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [2, 1, 0.4228, 0.0741, 1, 0.58, 0.5, 402, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_bases", "arg_names": ["node", "recurse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_bases(node, recurse=False):\n bases = [x.attrib['ref'] for x in node.findall('base')]\n if recurse:\n j = 0\n while True:\n try:\n b = bases[j]\n except IndexError: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L64_C8", "label": "bases =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "vector": [14, 2, 0.3951, 0.0062, 2, 0.59, 0.0, 610, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bases", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bases = [x.attrib['ref'] for x in node.findall('base')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8", "label": "if", "type": "if", "loc": [65, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "vector": [4, 2, 0.4259, 0.0556, 2, 0.59, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if recurse:\n j = 0\n while True:\n try:\n b = bases[j]\n except IndexError: break\n if b in all_nodes:\n bases.extend(_get_bases(all_nodes[b]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L66_C12", "label": "j =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8", "vector": [14, 3, 0.4074, 0.0062, 3, 0.02, 0.0, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12", "label": "while", "type": "while", "loc": [67, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8", "vector": [5, 3, 0.4321, 0.0432, 3, 0.02, 1.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n b = bases[j]\n except IndexError: break\n if b in all_nodes:\n bases.extend(_get_bases(all_nodes[b]))\n j += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Try_L68_C16", "label": "try", "type": "try", "loc": [68, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12", "vector": [7, 4, 0.4259, 0.0185, 4, 0.3, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n b = bases[j]\n except IndexError: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L69_C20", "label": "b =", "type": "assigned_variable", "loc": [69, 69], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:Try_L68_C16", "vector": [14, 5, 0.4259, 0.0062, 5, 0.75, 0.0, 756, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b = bases[j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L71_C16", "label": "if", "type": "if", "loc": [71, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12", "vector": [4, 4, 0.4414, 0.0123, 4, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if b in all_nodes:\n bases.extend(_get_bases(all_nodes[b]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L72_C20", "label": "extend()", "type": "expression", "loc": [72, 72], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L71_C16", "vector": [8, 5, 0.4444, 0.0062, 5, 0.53, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " bases.extend(_get_bases(all_nodes[b]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L74_C8", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "vector": [13, 2, 0.4568, 0.0062, 2, 0.59, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bases"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L76_C4", "label": "type_index =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.4691, 0.0062, 1, 0.58, 0.5833, 27, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "type_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type_index = ['module', 'class', 'callable', 'object']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "label": "base_cmp", "type": "function", "loc": [78, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [2, 1, 0.5185, 0.0802, 1, 0.58, 0.6667, 285, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "base_cmp", "arg_names": ["a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def base_cmp(a, b):\n x = cmp(type_index.index(a.tag), type_index.index(b.tag))\n if x != 0: return x\n\n if a.tag == 'class' and b.tag == 'class':\n a_bases = _get_bases(a, recurse=True)\n b_bases = _get_bases(b, recurse=True)\n x = cmp(len(a_bases), len(b_bases))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L79_C8", "label": "x = cmp()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "vector": [14, 2, 0.4877, 0.0062, 2, 0.37, 0.0, 190, 3, 2, 0, 0, 275, 10, 3], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "cmp", "annotation": ""}, "snippet": " x = cmp(type_index.index(a.tag), type_index.index(b.tag))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L80_C8", "label": "if", "type": "if", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "vector": [4, 2, 0.4938, 0.0062, 2, 0.37, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x != 0: return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L80_C19", "label": "return", "type": "return", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L80_C8", "vector": [13, 3, 0.4938, 0.0062, 3, 0.26, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x != 0: return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "label": "if", "type": "if", "loc": [82, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "vector": [4, 2, 0.5247, 0.0432, 2, 0.37, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.tag == 'class' and b.tag == 'class':\n a_bases = _get_bases(a, recurse=True)\n b_bases = _get_bases(b, recurse=True)\n x = cmp(len(a_bases), len(b_bases))\n if x != 0: return x\n if a.attrib['id'] in b_bases: return -1\n if b.attrib['id'] in a_bases: return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L83_C12", "label": "a_bases = _get_bases()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [14, 3, 0.5123, 0.0062, 3, 0.72, 0.0, 823, 3, 2, 0, 0, 402, 10, 1], "semantic": {"name": "a_bases", "arg_names": [], "import_names": [], "rhs_call_name": "_get_bases", "annotation": ""}, "snippet": " a_bases = _get_bases(a, recurse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L84_C12", "label": "b_bases = _get_bases()", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [14, 3, 0.5185, 0.0062, 3, 0.72, 0.2, 892, 3, 2, 0, 0, 402, 10, 1], "semantic": {"name": "b_bases", "arg_names": [], "import_names": [], "rhs_call_name": "_get_bases", "annotation": ""}, "snippet": " b_bases = _get_bases(b, recurse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L85_C12", "label": "x = cmp()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [14, 3, 0.5247, 0.0062, 3, 0.72, 0.4, 190, 3, 2, 0, 0, 275, 10, 3], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "cmp", "annotation": ""}, "snippet": " x = cmp(len(a_bases), len(b_bases))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L86_C12", "label": "if", "type": "if", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [4, 3, 0.5309, 0.0062, 3, 0.72, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x != 0: return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L86_C23", "label": "return", "type": "return", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L86_C12", "vector": [13, 4, 0.5309, 0.0062, 4, 0.37, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x != 0: return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L87_C12", "label": "if", "type": "if", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [4, 3, 0.537, 0.0062, 3, 0.72, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.attrib['id'] in b_bases: return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L87_C42", "label": "return", "type": "return", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L87_C12", "vector": [13, 4, 0.537, 0.0062, 4, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.attrib['id'] in b_bases: return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L88_C12", "label": "if", "type": "if", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "vector": [4, 3, 0.5432, 0.0062, 3, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if b.attrib['id'] in a_bases: return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L88_C42", "label": "return", "type": "return", "loc": [88, 88], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L88_C12", "vector": [13, 4, 0.5432, 0.0062, 4, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if b.attrib['id'] in a_bases: return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L90_C8", "label": "return", "type": "return", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "vector": [13, 2, 0.5556, 0.0062, 2, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(a.attrib['id'].count('.'), b.attrib['id'].count('.'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L92_C4", "label": "nodes = getchildren()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [14, 1, 0.5679, 0.0062, 1, 0.58, 0.75, 696, 3, 0, 0, 0, 991, 10, 1], "semantic": {"name": "nodes", "arg_names": [], "import_names": [], "rhs_call_name": "getchildren", "annotation": ""}, "snippet": " nodes = root.getchildren()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L93_C4", "label": "sort()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [8, 1, 0.5741, 0.0062, 1, 0.58, 0.8333, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " nodes.sort(base_cmp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "label": "for node", "type": "for", "loc": [96, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [6, 1, 0.7562, 0.3333, 1, 0.58, 0.9167, 772, 2, 0, 0, 0, 0, 0, 19], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in nodes:\n name = node.attrib['id']\n doc = (node.text or '').decode('string-escape') + \"\\n\"\n if doc == \"\\n\": doc = \"\"\n\n # create parent, if missing\n parent = name\n while True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L97_C8", "label": "name =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [14, 2, 0.5988, 0.0062, 2, 0.76, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = node.attrib['id']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L98_C8", "label": "doc =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [14, 2, 0.6049, 0.0062, 2, 0.76, 0.1429, 555, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doc = (node.text or '').decode('string-escape') + \"\\n\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L99_C8", "label": "if", "type": "if", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [4, 2, 0.6111, 0.0062, 2, 0.76, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doc == \"\\n\": doc = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L99_C24", "label": "doc =", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L99_C8", "vector": [14, 3, 0.6111, 0.0062, 3, 0.54, 0.0, 555, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doc == \"\\n\": doc = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L102_C8", "label": "parent =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [14, 2, 0.6296, 0.0062, 2, 0.76, 0.4286, 80, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "label": "while", "type": "while", "loc": [103, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [5, 2, 0.6543, 0.0432, 2, 0.76, 0.5714, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n parent = '.'.join(parent.split('.')[:-1])\n if not parent: break\n if parent in object_cache: break\n obj = imp.new_module(parent)\n object_cache[parent] = obj\n sys.modules[parent] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L104_C12", "label": "parent = join()", "type": "assigned_variable", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [14, 3, 0.642, 0.0062, 3, 0.65, 0.0, 80, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " parent = '.'.join(parent.split('.')[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L105_C12", "label": "if", "type": "if", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [4, 3, 0.6481, 0.0062, 3, 0.65, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parent: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L106_C12", "label": "if", "type": "if", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [4, 3, 0.6543, 0.0062, 3, 0.65, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent in object_cache: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L107_C12", "label": "obj = new_module()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [14, 3, 0.6605, 0.0062, 3, 0.65, 0.6, 505, 3, 1, 0, 0, 649, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "new_module", "annotation": ""}, "snippet": " obj = imp.new_module(parent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L108_C12", "label": "assign", "type": "assigned_variable", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [14, 3, 0.6667, 0.0062, 3, 0.65, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_cache[parent] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L109_C12", "label": "assign", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "vector": [14, 3, 0.6728, 0.0062, 3, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.modules[parent] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "label": "if", "type": "if", "loc": [112, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [4, 2, 0.787, 0.1975, 2, 0.76, 0.7143, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.tag == 'module':\n obj = imp.new_module(name)\n obj.__doc__ = doc\n sys.modules[name] = obj\n elif node.tag == 'class':\n bases = [object_cache[b] for b in _get_bases(node)\n if b in object_cache]\n bases.append(object)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L113_C12", "label": "obj = new_module()", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "vector": [14, 3, 0.6975, 0.0062, 3, 0.69, 0.0, 505, 3, 1, 0, 0, 649, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "new_module", "annotation": ""}, "snippet": " obj = imp.new_module(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L114_C12", "label": "obj.__doc__ =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "vector": [14, 3, 0.7037, 0.0062, 3, 0.69, 0.3333, 22, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__doc__ = doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L115_C12", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "vector": [14, 3, 0.7099, 0.0062, 3, 0.69, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.modules[name] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "label": "if", "type": "if", "loc": [116, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "vector": [4, 3, 0.7994, 0.1728, 3, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif node.tag == 'class':\n bases = [object_cache[b] for b in _get_bases(node)\n if b in object_cache]\n bases.append(object)\n init = lambda self: None\n init.__doc__ = doc\n obj = type(name, tuple(bases), {'__doc__': doc, '__init__': init})\n obj.__name__ = name.split('.')[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L117_C12", "label": "bases =", "type": "assigned_variable", "loc": [117, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [14, 4, 0.7253, 0.0123, 4, 0.22, 0.0, 610, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bases", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bases = [object_cache[b] for b in _get_bases(node)\n if b in object_cache]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L119_C12", "label": "append()", "type": "expression", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [8, 4, 0.7346, 0.0062, 4, 0.22, 0.1667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " bases.append(object)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L120_C12", "label": "init =", "type": "assigned_variable", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [14, 4, 0.7407, 0.0062, 4, 0.22, 0.3333, 319, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init = lambda self: None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L121_C12", "label": "init.__doc__ =", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [14, 4, 0.7469, 0.0062, 4, 0.22, 0.5, 105, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "init.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " init.__doc__ = doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L122_C12", "label": "obj = type()", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [14, 4, 0.7531, 0.0062, 4, 0.22, 0.6667, 505, 3, 3, 0, 0, 801, 10, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "type", "annotation": ""}, "snippet": " obj = type(name, tuple(bases), {'__doc__': doc, '__init__': init})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L123_C12", "label": "obj.__name__ =", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [14, 4, 0.7593, 0.0062, 4, 0.22, 0.8333, 786, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "obj.__name__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__name__ = name.split('.')[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "label": "if", "type": "if", "loc": [124, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "vector": [4, 4, 0.8241, 0.1235, 4, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif node.tag == 'callable':\n funcname = node.attrib['id'].split('.')[-1]\n argspec = node.attrib.get('argspec')\n if argspec:\n argspec = re.sub('^[^(]*', '', argspec)\n doc = \"%s%s\\n\\n%s\" % (funcname, argspec, doc)\n obj = lambda: 0\n obj.__argspec_is_invalid_ = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L125_C12", "label": "funcname =", "type": "assigned_variable", "loc": [125, 125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.7716, 0.0062, 5, 0.64, 0.0, 547, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "funcname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " funcname = node.attrib['id'].split('.')[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L126_C12", "label": "argspec = get()", "type": "assigned_variable", "loc": [126, 126], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.7778, 0.0062, 5, 0.64, 0.0769, 404, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "argspec", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " argspec = node.attrib.get('argspec')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12", "label": "if", "type": "if", "loc": [127, 129], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [4, 5, 0.7901, 0.0185, 5, 0.64, 0.1538, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argspec:\n argspec = re.sub('^[^(]*', '', argspec)\n doc = \"%s%s\\n\\n%s\" % (funcname, argspec, doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L128_C16", "label": "argspec = sub()", "type": "assigned_variable", "loc": [128, 128], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12", "vector": [14, 6, 0.7901, 0.0062, 6, 0.75, 0.0, 404, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "argspec", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " argspec = re.sub('^[^(]*', '', argspec)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L129_C16", "label": "doc =", "type": "assigned_variable", "loc": [129, 129], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12", "vector": [14, 6, 0.7963, 0.0062, 6, 0.75, 1.0, 555, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doc = \"%s%s\\n\\n%s\" % (funcname, argspec, doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L130_C12", "label": "obj =", "type": "assigned_variable", "loc": [130, 130], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8025, 0.0062, 5, 0.64, 0.2308, 505, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj = lambda: 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L131_C12", "label": "obj.__argspec_is_invalid_ =", "type": "assigned_variable", "loc": [131, 131], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8086, 0.0062, 5, 0.64, 0.3077, 835, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "obj.__argspec_is_invalid_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__argspec_is_invalid_ = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L132_C12", "label": "obj.func_name =", "type": "assigned_variable", "loc": [132, 132], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8148, 0.0062, 5, 0.64, 0.3846, 62, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.func_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.func_name = funcname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L133_C12", "label": "obj.__name__ =", "type": "assigned_variable", "loc": [133, 133], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.821, 0.0062, 5, 0.64, 0.4615, 786, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__name__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__name__ = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L134_C12", "label": "obj.__doc__ =", "type": "assigned_variable", "loc": [134, 134], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8272, 0.0062, 5, 0.64, 0.5385, 22, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__doc__ = doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L135_C12", "label": "if", "type": "if", "loc": [135, 136], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [4, 5, 0.8364, 0.0123, 5, 0.64, 0.6154, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inspect.isclass(object_cache[parent]):\n obj.__objclass__ = object_cache[parent]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L136_C16", "label": "obj.__objclass__ =", "type": "assigned_variable", "loc": [136, 136], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L135_C12", "vector": [14, 6, 0.8395, 0.0062, 6, 0.14, 0.0, 404, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__objclass__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__objclass__ = object_cache[parent]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:ClassDef_L138_C12", "label": "Dummy", "type": "class", "loc": [138, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [3, 5, 0.8519, 0.0062, 5, 0.64, 0.6923, 348, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "Dummy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Dummy(object): pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L139_C12", "label": "obj = Dummy()", "type": "assigned_variable", "loc": [139, 139], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.858, 0.0062, 5, 0.64, 0.7692, 505, 3, 0, 0, 0, 348, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "Dummy", "annotation": ""}, "snippet": " obj = Dummy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L140_C12", "label": "obj.__name__ =", "type": "assigned_variable", "loc": [140, 140], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8642, 0.0062, 5, 0.64, 0.8462, 786, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__name__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__name__ = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L141_C12", "label": "obj.__doc__ =", "type": "assigned_variable", "loc": [141, 141], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [14, 5, 0.8704, 0.0062, 5, 0.64, 0.9231, 22, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__doc__ = doc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L142_C12", "label": "if", "type": "if", "loc": [142, 143], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "vector": [4, 5, 0.8796, 0.0123, 5, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inspect.isclass(object_cache[parent]):\n obj.__get__ = lambda: None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L143_C16", "label": "obj.__get__ =", "type": "assigned_variable", "loc": [143, 143], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L142_C12", "vector": [14, 6, 0.8827, 0.0062, 6, 0.04, 0.0, 311, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__get__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__get__ = lambda: None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L144_C8", "label": "assign", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [14, 2, 0.8889, 0.0062, 2, 0.76, 0.8571, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_cache[name] = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L146_C8", "label": "if", "type": "if", "loc": [146, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "vector": [4, 2, 0.9105, 0.0247, 2, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent:\n if inspect.ismodule(object_cache[parent]):\n obj.__module__ = parent\n setattr(object_cache[parent], name.split('.')[-1], obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12", "label": "if", "type": "if", "loc": [147, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L146_C8", "vector": [4, 3, 0.9136, 0.0185, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inspect.ismodule(object_cache[parent]):\n obj.__module__ = parent\n setattr(object_cache[parent], name.split('.')[-1], obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L148_C16", "label": "obj.__module__ =", "type": "assigned_variable", "loc": [148, 148], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12", "vector": [14, 4, 0.9136, 0.0062, 4, 0.67, 0.0, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj.__module__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__module__ = parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L149_C16", "label": "setattr()", "type": "expression", "loc": [149, 149], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12", "vector": [8, 4, 0.9198, 0.0062, 4, 0.67, 1.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(object_cache[parent], name.split('.')[-1], obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "label": "for node", "type": "for", "loc": [152, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "vector": [6, 1, 0.9691, 0.0679, 1, 0.58, 1.0, 772, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in root:\n obj = object_cache.get(node.attrib['id'])\n if obj is None: continue\n for ref in node.findall('ref'):\n if node.tag == 'class':\n if ref.attrib['ref'].startswith(node.attrib['id'] + '.'):\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L153_C8", "label": "obj = get()", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "vector": [14, 2, 0.9444, 0.0062, 2, 0.92, 0.0, 505, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " obj = object_cache.get(node.attrib['id'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L154_C8", "label": "if", "type": "if", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "vector": [4, 2, 0.9506, 0.0062, 2, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:For_L155_C8", "label": "for ref", "type": "for", "loc": [155, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "vector": [6, 2, 0.9784, 0.0494, 2, 0.92, 1.0, 686, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "ref", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ref in node.findall('ref'):\n if node.tag == 'class':\n if ref.attrib['ref'].startswith(node.attrib['id'] + '.'):\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))\n else:\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12", "label": "if", "type": "if", "loc": [156, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:For_L155_C8", "vector": [4, 3, 0.9815, 0.0432, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.tag == 'class':\n if ref.attrib['ref'].startswith(node.attrib['id'] + '.'):\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))\n else:\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:If_L157_C16", "label": "if", "type": "if", "loc": [157, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12", "vector": [4, 4, 0.9753, 0.0185, 4, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ref.attrib['ref'].startswith(node.attrib['id'] + '.'):\n setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L158_C20", "label": "setattr()", "type": "expression", "loc": [158, 159], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L157_C16", "vector": [8, 5, 0.9784, 0.0123, 5, 0.92, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L161_C16", "label": "setattr()", "type": "expression", "loc": [161, 162], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12", "vector": [8, 4, 0.9969, 0.0123, 4, 0.5, 1.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(obj, ref.attrib['name'],\n object_cache.get(ref.attrib['ref']))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Import_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Try_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:Try_L68_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L69_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L67_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L71_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L72_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L80_C19"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L86_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L87_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L87_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L88_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Return_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L99_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:While_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L129_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L135_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L136_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:ClassDef_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L148_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_762:For_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:For_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:If_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L157_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L158_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_762:If_L156_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_762:Expr_L161_C16"}] |
from numpydoc import setup
| ajibawa-2023/Python-Code-Large/train/row_763 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_763:ImportFrom_L1_C0", "label": "from numpydoc import setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 32, 0, 1, 0, 0, 32, 0, 0], "semantic": {"name": "numpydoc", "arg_names": [], "import_names": ["setup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from numpydoc import setup"}] | [] |
import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
# string conversion routines
def _str_header(self, name, symbol='`'):
return ['.. rubric:: ' + name, '']
def _str_field_list(self, name):
return [':' + name + ':']
def _str_indent(self, doc, indent=4):
out = []
for line in doc:
out += [' '*indent + line]
return out
def _str_signature(self):
return ['']
if self['Signature']:
return ['``%s``' % self['Signature']] + ['']
else:
return ['']
def _str_summary(self):
return self['Summary'] + ['']
def _str_extended_summary(self):
return self['Extended Summary'] + ['']
def _str_param_list(self, name):
out = []
if self[name]:
out += self._str_field_list(name)
out += ['']
for param,param_type,desc in self[name]:
out += self._str_indent(['**%s** : %s' % (param.strip(),
param_type)])
out += ['']
out += self._str_indent(desc,8)
out += ['']
return out
def _str_section(self, name):
out = []
if self[name]:
out += self._str_header(name)
out += ['']
content = textwrap.dedent("\n".join(self[name])).split("\n")
out += content
out += ['']
return out
def _str_see_also(self, func_role):
out = []
if self['See Also']:
see_also = super(SphinxDocString, self)._str_see_also(func_role)
out = ['.. seealso::', '']
out += self._str_indent(see_also[2:])
return out
def _str_warnings(self):
out = []
if self['Warnings']:
out = ['.. warning::', '']
out += self._str_indent(self['Warnings'])
return out
def _str_index(self):
idx = self['index']
out = []
if len(idx) == 0:
return out
out += ['.. index:: %s' % idx.get('default','')]
for section, references in idx.iteritems():
if section == 'default':
continue
elif section == 'refguide':
out += [' single: %s' % (', '.join(references))]
else:
out += [' %s: %s' % (section, ','.join(references))]
return out
def _str_references(self):
out = []
if self['References']:
out += self._str_header('References')
if isinstance(self['References'], str):
self['References'] = [self['References']]
out.extend(self['References'])
out += ['']
# Latex collects all references to a separate bibliography,
# so we need to insert links to it
if sphinx.__version__ >= 0.6:
out += ['.. only:: latex','']
else:
out += ['.. latexonly::','']
items = []
for line in self['References']:
m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
if m:
items.append(m.group(1))
out += [' ' + ", ".join(["[%s]_" % item for item in items]), '']
return out
def __str__(self, indent=0, func_role="obj"):
out = []
out += self._str_signature()
out += self._str_index() + ['']
out += self._str_summary()
out += self._str_extended_summary()
for param_list in ('Parameters', 'Attributes', 'Methods',
'Returns','Raises'):
out += self._str_param_list(param_list)
out += self._str_warnings()
out += self._str_see_also(func_role)
out += self._str_section('Notes')
out += self._str_references()
out += self._str_section('Examples')
out = self._str_indent(out,indent)
return '\n'.join(out)
class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
pass
class SphinxClassDoc(SphinxDocString, ClassDoc):
pass
def get_doc_object(obj, what=None, doc=None):
if what is None:
if inspect.isclass(obj):
what = 'class'
elif inspect.ismodule(obj):
what = 'module'
elif callable(obj):
what = 'function'
else:
what = 'object'
if what == 'class':
return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)
elif what in ('function', 'method'):
return SphinxFunctionDoc(obj, '', doc=doc)
else:
if doc is None:
doc = pydoc.getdoc(obj)
return SphinxDocString(doc)
| ajibawa-2023/Python-Code-Large/train/row_764 | 87 | 149 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_764:Import_L1_C0", "label": "re import re, inspect, textwrap\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 0, 0.66, 0.0, 540, 0, 4, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re", "inspect", "textwrap", "pydoc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re, inspect, textwrap, pydoc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Import_L2_C0", "label": "sphinx import sphinx", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0134, 0.0067, 0, 0.66, 0.1667, 522, 0, 1, 0, 0, 522, 0, 0], "semantic": {"name": "sphinx", "arg_names": [], "import_names": ["sphinx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sphinx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:ImportFrom_L3_C0", "label": "from docscrape import NumpyDocString, FunctionDoc, ClassDoc", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0201, 0.0067, 0, 0.66, 0.3333, 91, 0, 3, 0, 0, 91, 0, 0], "semantic": {"name": "docscrape", "arg_names": [], "import_names": ["NumpyDocString", "FunctionDoc", "ClassDoc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from docscrape import NumpyDocString, FunctionDoc, ClassDoc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "label": "SphinxDocString", "type": "class", "loc": [5, 123], "level": 0, "parent": null, "vector": [3, 0, 0.4295, 0.7987, 0, 0.66, 0.5, 331, 0, 13, 0, 0, 241, 0, 36], "semantic": {"name": "SphinxDocString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SphinxDocString(NumpyDocString):\n # string conversion routines\n def _str_header(self, name, symbol='`'):\n return ['.. rubric:: ' + name, '']\n\n def _str_field_list(self, name):\n return [':' + name + ':']\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4", "label": "_str_header", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.0503, 0.0134, 1, 0.95, 0.0, 668, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_str_header", "arg_names": ["self", "name", "symbol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_header(self, name, symbol='`'):\n return ['.. rubric:: ' + name, '']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4", "vector": [13, 2, 0.0537, 0.0067, 2, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ['.. rubric:: ' + name, '']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L10_C4", "label": "_str_field_list", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.0705, 0.0134, 1, 0.95, 0.0833, 517, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_str_field_list", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_field_list(self, name):\n return [':' + name + ':']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L10_C4", "vector": [13, 2, 0.0738, 0.0067, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [':' + name + ':']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "label": "_str_indent", "type": "function", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.1007, 0.0336, 1, 0.95, 0.1667, 570, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_str_indent", "arg_names": ["self", "doc", "indent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_indent(self, doc, indent=4):\n out = []\n for line in doc:\n out += [' '*indent + line]\n return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L14_C8", "label": "out =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "vector": [14, 2, 0.094, 0.0067, 2, 0.88, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:For_L15_C8", "label": "for line", "type": "for", "loc": [15, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "vector": [6, 2, 0.104, 0.0134, 2, 0.88, 0.5, 373, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in doc:\n out += [' '*indent + line]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "vector": [13, 2, 0.1141, 0.0067, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4", "label": "_str_signature", "type": "function", "loc": [19, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.1443, 0.0403, 1, 0.95, 0.25, 64, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_str_signature", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_signature(self):\n return ['']\n if self['Signature']:\n return ['``%s``' % self['Signature']] + ['']\n else:\n return ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4", "vector": [13, 2, 0.1342, 0.0067, 2, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8", "label": "if", "type": "if", "loc": [21, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4", "vector": [4, 2, 0.151, 0.0268, 2, 0.3, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['Signature']:\n return ['``%s``' % self['Signature']] + ['']\n else:\n return ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L22_C12", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8", "vector": [13, 3, 0.1477, 0.0067, 3, 0.95, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ['``%s``' % self['Signature']] + ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L24_C12", "label": "return", "type": "return", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8", "vector": [13, 3, 0.1611, 0.0067, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L26_C4", "label": "_str_summary", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.1779, 0.0134, 1, 0.95, 0.3333, 947, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_str_summary", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_summary(self):\n return self['Summary'] + ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L26_C4", "vector": [13, 2, 0.1812, 0.0067, 2, 0.52, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self['Summary'] + ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L29_C4", "label": "_str_extended_summary", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.198, 0.0134, 1, 0.95, 0.4167, 522, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_str_extended_summary", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_extended_summary(self):\n return self['Extended Summary'] + ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L29_C4", "vector": [13, 2, 0.2013, 0.0067, 2, 0.12, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self['Extended Summary'] + ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "label": "_str_param_list", "type": "function", "loc": [32, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.2517, 0.0805, 1, 0.95, 0.5, 403, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_str_param_list", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_param_list(self, name):\n out = []\n if self[name]:\n out += self._str_field_list(name)\n out += ['']\n for param,param_type,desc in self[name]:\n out += self._str_indent(['**%s** : %s' % (param.strip(),\n param_type)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L33_C8", "label": "out =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "vector": [14, 2, 0.2215, 0.0067, 2, 0.41, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L34_C8", "label": "if", "type": "if", "loc": [34, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "vector": [4, 2, 0.255, 0.0604, 2, 0.41, 0.5, 0, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self[name]:\n out += self._str_field_list(name)\n out += ['']\n for param,param_type,desc in self[name]:\n out += self._str_indent(['**%s** : %s' % (param.strip(),\n param_type)])\n out += ['']\n out += self._str_indent(desc,8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:For_L37_C12", "label": "for param, param_type, desc", "type": "for", "loc": [37, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L34_C8", "vector": [6, 3, 0.2651, 0.0403, 3, 0.78, 0.0, 536, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "param, param_type, desc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param,param_type,desc in self[name]:\n out += self._str_indent(['**%s** : %s' % (param.strip(),\n param_type)])\n out += ['']\n out += self._str_indent(desc,8)\n out += ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "vector": [13, 2, 0.2886, 0.0067, 2, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "label": "_str_section", "type": "function", "loc": [45, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.3289, 0.0604, 1, 0.95, 0.5833, 387, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_str_section", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_section(self, name):\n out = []\n if self[name]:\n out += self._str_header(name)\n out += ['']\n content = textwrap.dedent(\"\\n\".join(self[name])).split(\"\\n\")\n out += content\n out += ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L46_C8", "label": "out =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "vector": [14, 2, 0.3087, 0.0067, 2, 0.42, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L47_C8", "label": "if", "type": "if", "loc": [47, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "vector": [4, 2, 0.3322, 0.0403, 2, 0.42, 0.5, 0, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self[name]:\n out += self._str_header(name)\n out += ['']\n content = textwrap.dedent(\"\\n\".join(self[name])).split(\"\\n\")\n out += content\n out += ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L50_C12", "label": "content = split()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L47_C8", "vector": [14, 3, 0.3356, 0.0067, 3, 0.83, 0.0, 273, 3, 1, 0, 0, 908, 10, 3], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " content = textwrap.dedent(\"\\n\".join(self[name])).split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "vector": [13, 2, 0.3557, 0.0067, 2, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "label": "_str_see_also", "type": "function", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.3893, 0.047, 1, 0.95, 0.6667, 922, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_str_see_also", "arg_names": ["self", "func_role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_see_also(self, func_role):\n out = []\n if self['See Also']:\n see_also = super(SphinxDocString, self)._str_see_also(func_role)\n out = ['.. seealso::', '']\n out += self._str_indent(see_also[2:])\n return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L56_C8", "label": "out =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "vector": [14, 2, 0.3758, 0.0067, 2, 0.46, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "vector": [4, 2, 0.3926, 0.0268, 2, 0.46, 0.5, 0, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['See Also']:\n see_also = super(SphinxDocString, self)._str_see_also(func_role)\n out = ['.. seealso::', '']\n out += self._str_indent(see_also[2:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L58_C12", "label": "see_also = _str_see_also()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8", "vector": [14, 3, 0.3893, 0.0067, 3, 0.18, 0.0, 793, 3, 1, 0, 0, 922, 10, 2], "semantic": {"name": "see_also", "arg_names": [], "import_names": [], "rhs_call_name": "_str_see_also", "annotation": ""}, "snippet": " see_also = super(SphinxDocString, self)._str_see_also(func_role)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L59_C12", "label": "out =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8", "vector": [14, 3, 0.396, 0.0067, 3, 0.18, 1.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = ['.. seealso::', '']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L61_C8", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "vector": [13, 2, 0.4094, 0.0067, 2, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "label": "_str_warnings", "type": "function", "loc": [63, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.4396, 0.0403, 1, 0.95, 0.75, 912, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_str_warnings", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_warnings(self):\n out = []\n if self['Warnings']:\n out = ['.. warning::', '']\n out += self._str_indent(self['Warnings'])\n return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L64_C8", "label": "out =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "vector": [14, 2, 0.4295, 0.0067, 2, 0.96, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L65_C8", "label": "if", "type": "if", "loc": [65, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "vector": [4, 2, 0.443, 0.0201, 2, 0.96, 0.5, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['Warnings']:\n out = ['.. warning::', '']\n out += self._str_indent(self['Warnings'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L66_C12", "label": "out =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L65_C8", "vector": [14, 3, 0.443, 0.0067, 3, 0.3, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = ['.. warning::', '']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L68_C8", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "vector": [13, 2, 0.4564, 0.0067, 2, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "label": "_str_index", "type": "function", "loc": [70, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.5168, 0.1007, 1, 0.95, 0.8333, 659, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "_str_index", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_index(self):\n idx = self['index']\n out = []\n if len(idx) == 0:\n return out\n\n out += ['.. index:: %s' % idx.get('default','')]\n for section, references in idx.iteritems():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L71_C8", "label": "idx =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "vector": [14, 2, 0.4765, 0.0067, 2, 0.54, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = self['index']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L72_C8", "label": "out =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "vector": [14, 2, 0.4832, 0.0067, 2, 0.54, 0.25, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L73_C8", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "vector": [4, 2, 0.4933, 0.0134, 2, 0.54, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(idx) == 0:\n return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L74_C12", "label": "return", "type": "return", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L73_C8", "vector": [13, 3, 0.4966, 0.0067, 3, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:For_L77_C8", "label": "for section, references", "type": "for", "loc": [77, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "vector": [6, 2, 0.5369, 0.047, 2, 0.54, 0.75, 684, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "section, references", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for section, references in idx.iteritems():\n if section == 'default':\n continue\n elif section == 'refguide':\n out += [' single: %s' % (', '.join(references))]\n else:\n out += [' %s: %s' % (section, ','.join(references))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L78_C12", "label": "if", "type": "if", "loc": [78, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:For_L77_C8", "vector": [4, 3, 0.5403, 0.0403, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if section == 'default':\n continue\n elif section == 'refguide':\n out += [' single: %s' % (', '.join(references))]\n else:\n out += [' %s: %s' % (section, ','.join(references))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L80_C12", "label": "if", "type": "if", "loc": [80, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L78_C12", "vector": [4, 4, 0.547, 0.0268, 4, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif section == 'refguide':\n out += [' single: %s' % (', '.join(references))]\n else:\n out += [' %s: %s' % (section, ','.join(references))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "vector": [13, 2, 0.5638, 0.0067, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "label": "_str_references", "type": "function", "loc": [86, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.6443, 0.1409, 1, 0.95, 0.9167, 408, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "_str_references", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _str_references(self):\n out = []\n if self['References']:\n out += self._str_header('References')\n if isinstance(self['References'], str):\n self['References'] = [self['References']]\n out.extend(self['References'])\n out += ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L87_C8", "label": "out =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "vector": [14, 2, 0.5839, 0.0067, 2, 0.11, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "label": "if", "type": "if", "loc": [88, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "vector": [4, 2, 0.6477, 0.1208, 2, 0.11, 0.5, 0, 6, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['References']:\n out += self._str_header('References')\n if isinstance(self['References'], str):\n self['References'] = [self['References']]\n out.extend(self['References'])\n out += ['']\n # Latex collects all references to a separate bibliography,\n # so we need to insert links to it"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L90_C12", "label": "if", "type": "if", "loc": [90, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "vector": [4, 3, 0.6074, 0.0134, 3, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self['References'], str):\n self['References'] = [self['References']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L91_C16", "label": "assign", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L90_C12", "vector": [14, 4, 0.6107, 0.0067, 4, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['References'] = [self['References']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Expr_L92_C12", "label": "extend()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "vector": [8, 3, 0.6174, 0.0067, 3, 0.76, 0.25, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " out.extend(self['References'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L96_C12", "label": "if", "type": "if", "loc": [96, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "vector": [4, 3, 0.6544, 0.0268, 3, 0.76, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sphinx.__version__ >= 0.6:\n out += ['.. only:: latex','']\n else:\n out += ['.. latexonly::','']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L100_C12", "label": "items =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "vector": [14, 3, 0.6711, 0.0067, 3, 0.76, 0.75, 339, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12", "label": "for line", "type": "for", "loc": [101, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "vector": [6, 3, 0.6879, 0.0268, 3, 0.76, 1.0, 373, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in self['References']:\n m = re.match(r'.. \\[([a-z0-9._-]+)\\]', line, re.I)\n if m:\n items.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L102_C16", "label": "m = match()", "type": "assigned_variable", "loc": [102, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12", "vector": [14, 4, 0.6846, 0.0067, 4, 0.36, 0.0, 711, 3, 3, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = re.match(r'.. \\[([a-z0-9._-]+)\\]', line, re.I)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L103_C16", "label": "if", "type": "if", "loc": [103, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12", "vector": [4, 4, 0.6946, 0.0134, 4, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n items.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Expr_L104_C20", "label": "append()", "type": "expression", "loc": [104, 104], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L103_C16", "vector": [8, 5, 0.698, 0.0067, 5, 0.13, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " items.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L106_C8", "label": "return", "type": "return", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "vector": [13, 2, 0.7114, 0.0067, 2, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "label": "__str__", "type": "function", "loc": [108, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "vector": [2, 1, 0.7752, 0.1074, 1, 0.95, 1.0, 527, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "__str__", "arg_names": ["self", "indent", "func_role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self, indent=0, func_role=\"obj\"):\n out = []\n out += self._str_signature()\n out += self._str_index() + ['']\n out += self._str_summary()\n out += self._str_extended_summary()\n for param_list in ('Parameters', 'Attributes', 'Methods',\n 'Returns','Raises'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L109_C8", "label": "out =", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "vector": [14, 2, 0.7315, 0.0067, 2, 0.65, 0.0, 434, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:For_L114_C8", "label": "for param_list", "type": "for", "loc": [114, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "vector": [6, 2, 0.7718, 0.0201, 2, 0.65, 0.3333, 459, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "param_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param_list in ('Parameters', 'Attributes', 'Methods',\n 'Returns','Raises'):\n out += self._str_param_list(param_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L122_C8", "label": "out = _str_indent()", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "vector": [14, 2, 0.8188, 0.0067, 2, 0.65, 0.6667, 434, 3, 2, 0, 0, 570, 10, 1], "semantic": {"name": "out", "arg_names": [], "import_names": [], "rhs_call_name": "_str_indent", "annotation": ""}, "snippet": " out = self._str_indent(out,indent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L123_C8", "label": "return", "type": "return", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "vector": [13, 2, 0.8255, 0.0067, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join(out)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L125_C0", "label": "SphinxFunctionDoc", "type": "class", "loc": [125, 126], "level": 0, "parent": null, "vector": [3, 0, 0.8423, 0.0134, 0, 0.66, 0.6667, 944, 0, 0, 0, 0, 331, 0, 0], "semantic": {"name": "SphinxFunctionDoc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SphinxFunctionDoc(SphinxDocString, FunctionDoc):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L128_C0", "label": "SphinxClassDoc", "type": "class", "loc": [128, 129], "level": 0, "parent": null, "vector": [3, 0, 0.8624, 0.0134, 0, 0.66, 0.8333, 287, 0, 0, 0, 0, 331, 0, 0], "semantic": {"name": "SphinxClassDoc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SphinxClassDoc(SphinxDocString, ClassDoc):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L131_C0", "label": "get_doc_object", "type": "function", "loc": [131, 148], "level": 0, "parent": null, "vector": [2, 0, 0.9362, 0.1208, 0, 0.66, 1.0, 344, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "get_doc_object", "arg_names": ["obj", "what", "doc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_doc_object(obj, what=None, doc=None):\n if what is None:\n if inspect.isclass(obj):\n what = 'class'\n elif inspect.ismodule(obj):\n what = 'module'\n elif callable(obj):\n what = 'function'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L132_C4", "label": "if", "type": "if", "loc": [132, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L131_C0", "vector": [4, 1, 0.9128, 0.0604, 1, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what is None:\n if inspect.isclass(obj):\n what = 'class'\n elif inspect.ismodule(obj):\n what = 'module'\n elif callable(obj):\n what = 'function'\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8", "label": "if", "type": "if", "loc": [133, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L132_C4", "vector": [4, 2, 0.9161, 0.0537, 2, 0.13, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inspect.isclass(obj):\n what = 'class'\n elif inspect.ismodule(obj):\n what = 'module'\n elif callable(obj):\n what = 'function'\n else:\n what = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L134_C12", "label": "what =", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8", "vector": [14, 3, 0.8993, 0.0067, 3, 0.86, 0.0, 63, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = 'class'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8", "label": "if", "type": "if", "loc": [135, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8", "vector": [4, 3, 0.9228, 0.0403, 3, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif inspect.ismodule(obj):\n what = 'module'\n elif callable(obj):\n what = 'function'\n else:\n what = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L136_C12", "label": "what =", "type": "assigned_variable", "loc": [136, 136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8", "vector": [14, 4, 0.9128, 0.0067, 4, 0.11, 0.0, 63, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = 'module'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8", "label": "if", "type": "if", "loc": [137, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8", "vector": [4, 4, 0.9295, 0.0268, 4, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(obj):\n what = 'function'\n else:\n what = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L138_C12", "label": "what =", "type": "assigned_variable", "loc": [138, 138], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8", "vector": [14, 5, 0.9262, 0.0067, 5, 0.23, 0.0, 63, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = 'function'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L140_C12", "label": "what =", "type": "assigned_variable", "loc": [140, 140], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8", "vector": [14, 5, 0.9396, 0.0067, 5, 0.23, 1.0, 63, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4", "label": "if", "type": "if", "loc": [141, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L131_C0", "vector": [4, 1, 0.9698, 0.0537, 1, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what == 'class':\n return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)\n elif what in ('function', 'method'):\n return SphinxFunctionDoc(obj, '', doc=doc)\n else:\n if doc is None:\n doc = pydoc.getdoc(obj)\n return SphinxDocString(doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4", "vector": [13, 2, 0.953, 0.0067, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SphinxClassDoc(obj, '', func_doc=SphinxFunctionDoc, doc=doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "label": "if", "type": "if", "loc": [143, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4", "vector": [4, 2, 0.9765, 0.0403, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif what in ('function', 'method'):\n return SphinxFunctionDoc(obj, '', doc=doc)\n else:\n if doc is None:\n doc = pydoc.getdoc(obj)\n return SphinxDocString(doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "vector": [13, 3, 0.9664, 0.0067, 3, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SphinxFunctionDoc(obj, '', doc=doc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:If_L146_C8", "label": "if", "type": "if", "loc": [146, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "vector": [4, 3, 0.9832, 0.0134, 3, 0.79, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doc is None:\n doc = pydoc.getdoc(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L147_C12", "label": "doc = getdoc()", "type": "assigned_variable", "loc": [147, 147], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L146_C8", "vector": [14, 4, 0.9866, 0.0067, 4, 0.43, 0.0, 555, 3, 1, 0, 0, 521, 10, 1], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "getdoc", "annotation": ""}, "snippet": " doc = pydoc.getdoc(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L148_C8", "label": "return", "type": "return", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "vector": [13, 3, 0.9933, 0.0067, 3, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SphinxDocString(doc)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:For_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:For_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L70_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L90_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Expr_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:For_L101_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L103_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L103_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Expr_L104_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:For_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L135_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:FunctionDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_764:If_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_764:Return_L148_C8"}] |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.
.. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard
"""
import os, re, pydoc
from docscrape_sphinx import get_doc_object, SphinxDocString
import inspect
def mangle_docstrings(app, what, name, obj, options, lines,
reference_offset=[0]):
if what == 'module':
# Strip top title
title_re = re.compile(r'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*',
re.I|re.S)
lines[:] = title_re.sub('', "\n".join(lines)).split("\n")
else:
doc = get_doc_object(obj, what, "\n".join(lines))
lines[:] = str(doc).split("\n")
if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \
obj.__name__:
if hasattr(obj, '__module__'):
v = dict(full_name="%s.%s" % (obj.__module__, obj.__name__))
else:
v = dict(full_name=obj.__name__)
lines += ['', '.. htmlonly::', '']
lines += [' %s' % x for x in
(app.config.numpydoc_edit_link % v).split("\n")]
# replace reference numbers so that there are no duplicates
references = []
for line in lines:
line = line.strip()
m = re.match(r'^.. \[([a-z0-9_.-])\]', line, re.I)
if m:
references.append(m.group(1))
# start renaming from the longest string, to avoid overwriting parts
references.sort(key=lambda x: -len(x))
if references:
for i, line in enumerate(lines):
for r in references:
if re.match(r'^\d+$', r):
new_r = "R%d" % (reference_offset[0] + int(r))
else:
new_r = "%s%d" % (r, reference_offset[0])
lines[i] = lines[i].replace('[%s]_' % r,
'[%s]_' % new_r)
lines[i] = lines[i].replace('.. [%s]' % r,
'.. [%s]' % new_r)
reference_offset[0] += len(references)
def mangle_signature(app, what, name, obj, options, sig, retann):
# Do not try to inspect classes that don't define `__init__`
if (inspect.isclass(obj) and
'initializes x; see ' in pydoc.getdoc(obj.__init__)):
return '', ''
if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return
if not hasattr(obj, '__doc__'): return
doc = SphinxDocString(pydoc.getdoc(obj))
if doc['Signature']:
sig = re.sub("^[^(]*", "", doc['Signature'])
return sig, ''
def initialize(app):
try:
app.connect('autodoc-process-signature', mangle_signature)
except:
monkeypatch_sphinx_ext_autodoc()
def setup(app, get_doc_object_=get_doc_object):
global get_doc_object
get_doc_object = get_doc_object_
app.connect('autodoc-process-docstring', mangle_docstrings)
app.connect('builder-inited', initialize)
app.add_config_value('numpydoc_edit_link', None, True)
#------------------------------------------------------------------------------
# Monkeypatch sphinx.ext.autodoc to accept argspecless autodocs (Sphinx < 0.5)
#------------------------------------------------------------------------------
def monkeypatch_sphinx_ext_autodoc():
global _original_format_signature
import sphinx.ext.autodoc
if sphinx.ext.autodoc.format_signature is our_format_signature:
return
print "[numpydoc] Monkeypatching sphinx.ext.autodoc ..."
_original_format_signature = sphinx.ext.autodoc.format_signature
sphinx.ext.autodoc.format_signature = our_format_signature
def our_format_signature(what, obj):
r = mangle_signature(None, what, None, obj, None, None, None)
if r is not None:
return r[0]
else:
return _original_format_signature(what, obj)
| ajibawa-2023/Python-Code-Large/train/row_765 | 61 | 117 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1453, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n========\nnumpydoc\n========\n\nSphinx extension that handles docstrings in the Numpy standard format. [1]\n\nIt will:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Import_L19_C0", "label": "os import os, re, pydoc", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1624, 0.0085, 0, 0.66, 0.1111, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "pydoc"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, pydoc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:ImportFrom_L20_C0", "label": "from docscrape_sphinx import get_doc_object, SphinxDocString", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1709, 0.0085, 0, 0.66, 0.2222, 318, 0, 2, 0, 0, 318, 0, 0], "semantic": {"name": "docscrape_sphinx", "arg_names": [], "import_names": ["get_doc_object", "SphinxDocString"], "rhs_call_name": "", "annotation": ""}, "snippet": "from docscrape_sphinx import get_doc_object, SphinxDocString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Import_L21_C0", "label": "inspect import inspect", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1795, 0.0085, 0, 0.66, 0.3333, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"], "rhs_call_name": "", "annotation": ""}, "snippet": "import inspect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "label": "mangle_docstrings", "type": "function", "loc": [23, 67], "level": 0, "parent": null, "vector": [2, 0, 0.3846, 0.3846, 0, 0.66, 0.4444, 558, 0, 7, 0, 0, 0, 0, 25], "semantic": {"name": "mangle_docstrings", "arg_names": ["app", "what", "name", "obj", "options", "lines", "reference_offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mangle_docstrings(app, what, name, obj, options, lines,\n reference_offset=[0]):\n\n if what == 'module':\n # Strip top title\n title_re = re.compile(r'^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*',\n re.I|re.S)\n lines[:] = title_re.sub('', \"\\n\".join(lines)).split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "label": "if", "type": "if", "loc": [26, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [4, 1, 0.2521, 0.0684, 1, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what == 'module':\n # Strip top title\n title_re = re.compile(r'^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*',\n re.I|re.S)\n lines[:] = title_re.sub('', \"\\n\".join(lines)).split(\"\\n\")\n else:\n doc = get_doc_object(obj, what, \"\\n\".join(lines))\n lines[:] = str(doc).split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L28_C8", "label": "title_re = compile()", "type": "assigned_variable", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "vector": [14, 2, 0.2436, 0.0171, 2, 0.91, 0.0, 206, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "title_re", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " title_re = re.compile(r'^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*',\n re.I|re.S)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L30_C8", "label": " = split()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "vector": [14, 2, 0.2564, 0.0085, 2, 0.91, 0.3333, 0, 3, 1, 0, 0, 908, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " lines[:] = title_re.sub('', \"\\n\".join(lines)).split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L32_C8", "label": "doc = get_doc_object()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "vector": [14, 2, 0.2735, 0.0085, 2, 0.91, 0.6667, 555, 3, 3, 0, 0, 344, 10, 2], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "get_doc_object", "annotation": ""}, "snippet": " doc = get_doc_object(obj, what, \"\\n\".join(lines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L33_C8", "label": " = split()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "vector": [14, 2, 0.2821, 0.0085, 2, 0.91, 1.0, 0, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " lines[:] = str(doc).split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L35_C4", "label": "if", "type": "if", "loc": [35, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [4, 1, 0.3333, 0.0769, 1, 0.72, 0.2, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \\\n obj.__name__:\n if hasattr(obj, '__module__'):\n v = dict(full_name=\"%s.%s\" % (obj.__module__, obj.__name__))\n else:\n v = dict(full_name=obj.__name__)\n lines += ['', '.. htmlonly::', '']\n lines += [' %s' % x for x in"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L35_C4", "vector": [4, 2, 0.3291, 0.0342, 2, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(obj, '__module__'):\n v = dict(full_name=\"%s.%s\" % (obj.__module__, obj.__name__))\n else:\n v = dict(full_name=obj.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L38_C12", "label": "v = dict()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8", "vector": [14, 3, 0.3248, 0.0085, 3, 0.19, 0.0, 553, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " v = dict(full_name=\"%s.%s\" % (obj.__module__, obj.__name__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L40_C12", "label": "v = dict()", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8", "vector": [14, 3, 0.3419, 0.0085, 3, 0.19, 1.0, 553, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " v = dict(full_name=obj.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L46_C4", "label": "references =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [14, 1, 0.3932, 0.0085, 1, 0.72, 0.4, 500, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "references", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " references = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "label": "for line", "type": "for", "loc": [47, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [6, 1, 0.4188, 0.0427, 1, 0.72, 0.6, 373, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in lines:\n line = line.strip()\n m = re.match(r'^.. \\[([a-z0-9_.-])\\]', line, re.I)\n if m:\n references.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L48_C8", "label": "line = strip()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "vector": [14, 2, 0.4103, 0.0085, 2, 0.26, 0.0, 373, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " line = line.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L49_C8", "label": "m = match()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "vector": [14, 2, 0.4188, 0.0085, 2, 0.26, 0.5, 711, 3, 3, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = re.match(r'^.. \\[([a-z0-9_.-])\\]', line, re.I)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L50_C8", "label": "if", "type": "if", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "vector": [4, 2, 0.4316, 0.0171, 2, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n references.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L51_C12", "label": "append()", "type": "expression", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L50_C8", "vector": [8, 3, 0.4359, 0.0085, 3, 0.26, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " references.append(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L54_C4", "label": "sort()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [8, 1, 0.4615, 0.0085, 1, 0.72, 0.8, 489, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " references.sort(key=lambda x: -len(x))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L55_C4", "label": "if", "type": "if", "loc": [55, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "vector": [4, 1, 0.5128, 0.094, 1, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if references:\n for i, line in enumerate(lines):\n for r in references:\n if re.match(r'^\\d+$', r):\n new_r = \"R%d\" % (reference_offset[0] + int(r))\n else:\n new_r = \"%s%d\" % (r, reference_offset[0])\n lines[i] = lines[i].replace('[%s]_' % r,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:For_L56_C8", "label": "for i, line", "type": "for", "loc": [56, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L55_C4", "vector": [6, 2, 0.5171, 0.0855, 2, 0.73, 0.0, 54, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i, line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, line in enumerate(lines):\n for r in references:\n if re.match(r'^\\d+$', r):\n new_r = \"R%d\" % (reference_offset[0] + int(r))\n else:\n new_r = \"%s%d\" % (r, reference_offset[0])\n lines[i] = lines[i].replace('[%s]_' % r,\n '[%s]_' % new_r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "label": "for r", "type": "for", "loc": [57, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L56_C8", "vector": [6, 3, 0.5214, 0.0769, 3, 0.61, 0.0, 436, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in references:\n if re.match(r'^\\d+$', r):\n new_r = \"R%d\" % (reference_offset[0] + int(r))\n else:\n new_r = \"%s%d\" % (r, reference_offset[0])\n lines[i] = lines[i].replace('[%s]_' % r,\n '[%s]_' % new_r)\n lines[i] = lines[i].replace('.. [%s]' % r,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16", "label": "if", "type": "if", "loc": [58, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "vector": [4, 4, 0.5085, 0.0342, 4, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if re.match(r'^\\d+$', r):\n new_r = \"R%d\" % (reference_offset[0] + int(r))\n else:\n new_r = \"%s%d\" % (r, reference_offset[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L59_C20", "label": "new_r =", "type": "assigned_variable", "loc": [59, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16", "vector": [14, 5, 0.5043, 0.0085, 5, 0.47, 0.0, 128, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "new_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_r = \"R%d\" % (reference_offset[0] + int(r))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L61_C20", "label": "new_r =", "type": "assigned_variable", "loc": [61, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16", "vector": [14, 5, 0.5214, 0.0085, 5, 0.47, 1.0, 128, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_r = \"%s%d\" % (r, reference_offset[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L62_C16", "label": " = replace()", "type": "assigned_variable", "loc": [62, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "vector": [14, 4, 0.5342, 0.0171, 4, 0.47, 0.5, 0, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " lines[i] = lines[i].replace('[%s]_' % r,\n '[%s]_' % new_r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L64_C16", "label": " = replace()", "type": "assigned_variable", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "vector": [14, 4, 0.5513, 0.0171, 4, 0.47, 1.0, 0, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " lines[i] = lines[i].replace('.. [%s]' % r,\n '.. [%s]' % new_r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "label": "mangle_signature", "type": "function", "loc": [69, 81], "level": 0, "parent": null, "vector": [2, 0, 0.641, 0.1111, 0, 0.66, 0.5556, 659, 0, 7, 1, 0, 0, 0, 8], "semantic": {"name": "mangle_signature", "arg_names": ["app", "what", "name", "obj", "options", "sig", "retann"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mangle_signature(app, what, name, obj, options, sig, retann):\n # Do not try to inspect classes that don't define `__init__`\n if (inspect.isclass(obj) and\n 'initializes x; see ' in pydoc.getdoc(obj.__init__)):\n return '', ''\n\n if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return\n if not hasattr(obj, '__doc__'): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L71_C4", "label": "if", "type": "if", "loc": [71, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "vector": [4, 1, 0.6154, 0.0256, 1, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (inspect.isclass(obj) and\n 'initializes x; see ' in pydoc.getdoc(obj.__init__)):\n return '', ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L73_C8", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L71_C4", "vector": [13, 2, 0.6239, 0.0085, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '', ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L75_C4", "label": "if", "type": "if", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "vector": [4, 1, 0.641, 0.0085, 1, 0.65, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L75_C69", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L75_C4", "vector": [13, 2, 0.641, 0.0085, 2, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L76_C4", "label": "if", "type": "if", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "vector": [4, 1, 0.6496, 0.0085, 1, 0.65, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(obj, '__doc__'): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L76_C36", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L76_C4", "vector": [13, 2, 0.6496, 0.0085, 2, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(obj, '__doc__'): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L78_C4", "label": "doc = SphinxDocString()", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "vector": [14, 1, 0.6667, 0.0085, 1, 0.65, 0.75, 555, 3, 1, 0, 0, 331, 10, 2], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "SphinxDocString", "annotation": ""}, "snippet": " doc = SphinxDocString(pydoc.getdoc(obj))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4", "label": "if", "type": "if", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "vector": [4, 1, 0.6838, 0.0256, 1, 0.65, 1.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doc['Signature']:\n sig = re.sub(\"^[^(]*\", \"\", doc['Signature'])\n return sig, ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L80_C8", "label": "sig = sub()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4", "vector": [14, 2, 0.6838, 0.0085, 2, 0.4, 0.0, 899, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " sig = re.sub(\"^[^(]*\", \"\", doc['Signature'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L81_C8", "label": "return", "type": "return", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4", "vector": [13, 2, 0.6923, 0.0085, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sig, ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L83_C0", "label": "initialize", "type": "function", "loc": [83, 87], "level": 0, "parent": null, "vector": [2, 0, 0.7265, 0.0427, 0, 0.66, 0.6667, 393, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "initialize", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def initialize(app):\n try:\n app.connect('autodoc-process-signature', mangle_signature)\n except:\n monkeypatch_sphinx_ext_autodoc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4", "label": "try", "type": "try", "loc": [84, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L83_C0", "vector": [7, 1, 0.7308, 0.0342, 1, 0.8, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n app.connect('autodoc-process-signature', mangle_signature)\n except:\n monkeypatch_sphinx_ext_autodoc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L85_C8", "label": "connect()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4", "vector": [8, 2, 0.7265, 0.0085, 2, 0.95, 0.0, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " app.connect('autodoc-process-signature', mangle_signature)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L87_C8", "label": "monkeypatch_sphinx_ext_autodoc()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4", "vector": [8, 2, 0.7436, 0.0085, 2, 0.95, 0.0, 890, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "monkeypatch_sphinx_ext_autodoc", "arg_names": [], "import_names": [], "rhs_call_name": "monkeypatch_sphinx_ext_autodoc", "annotation": ""}, "snippet": " monkeypatch_sphinx_ext_autodoc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "label": "setup", "type": "function", "loc": [89, 95], "level": 0, "parent": null, "vector": [2, 0, 0.7863, 0.0598, 0, 0.66, 0.7778, 234, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setup", "arg_names": ["app", "get_doc_object_"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup(app, get_doc_object_=get_doc_object):\n global get_doc_object\n get_doc_object = get_doc_object_\n \n app.connect('autodoc-process-docstring', mangle_docstrings)\n app.connect('builder-inited', initialize)\n app.add_config_value('numpydoc_edit_link', None, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L91_C4", "label": "get_doc_object =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "vector": [14, 1, 0.7778, 0.0085, 1, 0.82, 0.0, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "get_doc_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " get_doc_object = get_doc_object_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L93_C4", "label": "connect()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "vector": [8, 1, 0.7949, 0.0085, 1, 0.82, 0.3333, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " app.connect('autodoc-process-docstring', mangle_docstrings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L94_C4", "label": "connect()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "vector": [8, 1, 0.8034, 0.0085, 1, 0.82, 0.6667, 242, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " app.connect('builder-inited', initialize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L95_C4", "label": "add_config_value()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "vector": [8, 1, 0.812, 0.0085, 1, 0.82, 1.0, 532, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_config_value", "arg_names": [], "import_names": [], "rhs_call_name": "add_config_value", "annotation": ""}, "snippet": " app.add_config_value('numpydoc_edit_link', None, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "label": "monkeypatch_sphinx_ext_autodoc", "type": "function", "loc": [101, 110], "level": 0, "parent": null, "vector": [2, 0, 0.9017, 0.0855, 0, 0.66, 0.8889, 890, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "monkeypatch_sphinx_ext_autodoc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def monkeypatch_sphinx_ext_autodoc():\n global _original_format_signature\n import sphinx.ext.autodoc\n\n if sphinx.ext.autodoc.format_signature is our_format_signature:\n return\n\n print(\"[numpydoc] Monkeypatching sphinx.ext.autodoc ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Import_L103_C4", "label": "sphinx.ext.autodoc import sphinx.ext.autodoc", "type": "import", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "vector": [1, 1, 0.8803, 0.0085, 1, 0.95, 0.0, 919, 0, 1, 0, 0, 919, 0, 0], "semantic": {"name": "sphinx.ext.autodoc", "arg_names": [], "import_names": ["sphinx.ext.autodoc"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sphinx.ext.autodoc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L105_C4", "label": "if", "type": "if", "loc": [105, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "vector": [4, 1, 0.9017, 0.0171, 1, 0.95, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sphinx.ext.autodoc.format_signature is our_format_signature:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L106_C8", "label": "return", "type": "return", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L105_C4", "vector": [13, 2, 0.906, 0.0085, 2, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L108_C4", "label": "print()", "type": "expression", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "vector": [8, 1, 0.9231, 0.0085, 1, 0.95, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"[numpydoc] Monkeypatching sphinx.ext.autodoc ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L109_C4", "label": "_original_format_signature =", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "vector": [14, 1, 0.9316, 0.0085, 1, 0.95, 0.75, 178, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_original_format_signature", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _original_format_signature = sphinx.ext.autodoc.format_signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L110_C4", "label": "sphinx.ext.autodoc.format_signature =", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "vector": [14, 1, 0.9402, 0.0085, 1, 0.95, 1.0, 156, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sphinx.ext.autodoc.format_signature", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sphinx.ext.autodoc.format_signature = our_format_signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L112_C0", "label": "our_format_signature", "type": "function", "loc": [112, 117], "level": 0, "parent": null, "vector": [2, 0, 0.9786, 0.0513, 0, 0.66, 1.0, 54, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "our_format_signature", "arg_names": ["what", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def our_format_signature(what, obj):\n r = mangle_signature(None, what, None, obj, None, None, None)\n if r is not None:\n return r[0]\n else:\n return _original_format_signature(what, obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L113_C4", "label": "r = mangle_signature()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L112_C0", "vector": [14, 1, 0.9658, 0.0085, 1, 0.26, 0.0, 436, 3, 7, 0, 0, 659, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "mangle_signature", "annotation": ""}, "snippet": " r = mangle_signature(None, what, None, obj, None, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4", "label": "if", "type": "if", "loc": [114, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L112_C0", "vector": [4, 1, 0.9872, 0.0342, 1, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r is not None:\n return r[0]\n else:\n return _original_format_signature(what, obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4", "vector": [13, 2, 0.9829, 0.0085, 2, 0.46, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return r[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4", "vector": [13, 2, 1.0, 0.0085, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _original_format_signature(what, obj)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:For_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L59_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L58_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L61_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L75_C69"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L76_C36"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:Try_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Import_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:FunctionDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_765:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_765:Return_L117_C8"}] |
# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
#
default_application = 'init' # ordinarily set in base routes.py
default_controller = 'default' # ordinarily set in app-specific routes.py
default_function = 'index' # ordinarily set in app-specific routes.py
# routes_app is a tuple of tuples. The first item in each is a regexp that will
# be used to match the incoming request URL. The second item in the tuple is
# an applicationname. This mechanism allows you to specify the use of an
# app-specific routes.py. This entry is meaningful only in the base routes.py.
#
# Example: support welcome, admin, app and myapp, with myapp the default:
routes_app = ((r'/(?P<app>welcome|admin|app)\b.*', r'\g<app>'),
(r'(.*)', r'myapp'),
(r'/?(.*)', r'myapp'))
# routes_in is a tuple of tuples. The first item in each is a regexp that will
# be used to match the incoming request URL. The second item in the tuple is
# what it will be replaced with. This mechanism allows you to redirect incoming
# routes to different web2py locations
#
# Example: If you wish for your entire website to use init's static directory:
#
# routes_in=( (r'/static/(?P<file>[\w./-]+)', r'/init/static/\g<file>') )
#
BASE = '' # optonal prefix for incoming URLs
routes_in = (
# do not reroute admin unless you want to disable it
(BASE + '/admin', '/admin/default/index'),
(BASE + '/admin/$anything', '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
(BASE + '/$app/appadmin', '/$app/appadmin/index'),
(BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),
# do not reroute static files
(BASE + '/$app/static/$anything', '/$app/static/$anything'),
# reroute favicon and robots, use exable for lack of better choice
('/favicon.ico', '/examples/static/favicon.ico'),
('/robots.txt', '/examples/static/robots.txt'),
# do other stuff
((r'.*http://otherdomain.com.* (?P<any>.*)', r'/app/ctr\g<any>')),
# remove the BASE prefix
(BASE + '/$anything', '/$anything'),
)
# routes_out, like routes_in translates URL paths created with the web2py URL()
# function in the same manner that route_in translates inbound URL paths.
#
routes_out = (
# do not reroute admin unless you want to disable it
('/admin/$anything', BASE + '/admin/$anything'),
# do not reroute appadmin unless you want to disable it
('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
# do not reroute static files
('/$app/static/$anything', BASE + '/$app/static/$anything'),
# do other stuff
(r'.*http://otherdomain.com.* /app/ctr(?P<any>.*)', r'\g<any>'),
(r'/app(?P<any>.*)', r'\g<any>'),
# restore the BASE prefix
('/$anything', BASE + '/$anything'),
)
# Specify log level for rewrite's debug logging
# Possible values: debug, info, warning, error, critical (loglevels),
# off, print (print uses print statement rather than logging)
# GAE users may want to use 'off' to suppress routine logging.
#
logging = 'debug'
# Error-handling redirects all HTTP errors (status codes >= 400) to a specified
# path. If you wish to use error-handling redirects, uncomment the tuple
# below. You can customize responses by adding a tuple entry with the first
# value in 'appName/HTTPstatusCode' format. ( Only HTTP codes >= 400 are
# routed. ) and the value as a path to redirect the user to. You may also use
# '*' as a wildcard.
#
# The error handling page is also passed the error code and ticket as
# variables. Traceback information will be stored in the ticket.
#
# routes_onerror = [
# (r'init/400', r'/init/default/login')
# ,(r'init/*', r'/init/static/fail.html')
# ,(r'*/404', r'/init/static/cantfind.html')
# ,(r'*/*', r'/init/error/index')
# ]
# specify action in charge of error handling
#
# error_handler = dict(application='error',
# controller='default',
# function='index')
# In the event that the error-handling page itself returns an error, web2py will
# fall back to its old static responses. You can customize them here.
# ErrorMessageTicket takes a string format dictionary containing (only) the
# "ticket" key.
# error_message = '<html><body><h1>%s</h1></body></html>'
# error_message_ticket = '<html><body><h1>Internal error</h1>Ticket issued: <a href="/admin/default/ticket/%(ticket)s" target="_blank">%(ticket)s</a></body></html>'
# specify a list of apps that bypass args-checking and use request.raw_args
#
#routes_apps_raw=['myapp']
#routes_apps_raw=['myapp', 'myotherapp']
def __routes_doctest():
'''
Dummy function for doctesting routes.py.
Use filter_url() to test incoming or outgoing routes;
filter_err() for error redirection.
filter_url() accepts overrides for method and remote host:
filter_url(url, method='get', remote='0.0.0.0', out=False)
filter_err() accepts overrides for application and ticket:
filter_err(status, application='app', ticket='tkt')
>>> import os
>>> import gluon.main
>>> from gluon.rewrite import regex_select, load, filter_url, regex_filter_out, filter_err, compile_regex
>>> regex_select()
>>> load(routes=os.path.basename(__file__))
>>> os.path.relpath(filter_url('http://domain.com/favicon.ico'))
'applications/examples/static/favicon.ico'
>>> os.path.relpath(filter_url('http://domain.com/robots.txt'))
'applications/examples/static/robots.txt'
>>> filter_url('http://domain.com')
'/init/default/index'
>>> filter_url('http://domain.com/')
'/init/default/index'
>>> filter_url('http://domain.com/init/default/fcn')
'/init/default/fcn'
>>> filter_url('http://domain.com/init/default/fcn/')
'/init/default/fcn'
>>> filter_url('http://domain.com/app/ctr/fcn')
'/app/ctr/fcn'
>>> filter_url('http://domain.com/app/ctr/fcn/arg1')
"/app/ctr/fcn ['arg1']"
>>> filter_url('http://domain.com/app/ctr/fcn/arg1/')
"/app/ctr/fcn ['arg1']"
>>> filter_url('http://domain.com/app/ctr/fcn/arg1//')
"/app/ctr/fcn ['arg1', '']"
>>> filter_url('http://domain.com/app/ctr/fcn//arg1')
"/app/ctr/fcn ['', 'arg1']"
>>> filter_url('HTTP://DOMAIN.COM/app/ctr/fcn')
'/app/ctr/fcn'
>>> filter_url('http://domain.com/app/ctr/fcn?query')
'/app/ctr/fcn ?query'
>>> filter_url('http://otherdomain.com/fcn')
'/app/ctr/fcn'
>>> regex_filter_out('/app/ctr/fcn')
'/ctr/fcn'
>>> filter_url('https://otherdomain.com/app/ctr/fcn', out=True)
'/ctr/fcn'
>>> filter_url('https://otherdomain.com/app/ctr/fcn/arg1//', out=True)
'/ctr/fcn/arg1//'
>>> filter_url('http://otherdomain.com/app/ctr/fcn', out=True)
'/fcn'
>>> filter_url('http://otherdomain.com/app/ctr/fcn?query', out=True)
'/fcn?query'
>>> filter_url('http://otherdomain.com/app/ctr/fcn#anchor', out=True)
'/fcn#anchor'
>>> filter_err(200)
200
>>> filter_err(399)
399
>>> filter_err(400)
400
>>> filter_url('http://domain.com/welcome', app=True)
'welcome'
>>> filter_url('http://domain.com/', app=True)
'myapp'
>>> filter_url('http://domain.com', app=True)
'myapp'
>>> compile_regex('.*http://otherdomain.com.* (?P<any>.*)', '/app/ctr\g<any>')[0].pattern
'^.*http://otherdomain.com.* (?P<any>.*)$'
>>> compile_regex('.*http://otherdomain.com.* (?P<any>.*)', '/app/ctr\g<any>')[1]
'/app/ctr\\\\g<any>'
>>> compile_regex('/$c/$f', '/init/$c/$f')[0].pattern
'^.*?:https?://[^:/]+:[a-z]+ /(?P<c>\\\\w+)/(?P<f>\\\\w+)$'
>>> compile_regex('/$c/$f', '/init/$c/$f')[1]
'/init/\\\\g<c>/\\\\g<f>'
'''
pass
if __name__ == '__main__':
import doctest
doctest.testmod()
| ajibawa-2023/Python-Code-Large/train/row_766 | 13 | 199 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L7_C0", "label": "default_application =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0352, 0.005, 0, 0.66, 0.0, 558, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "default_application = 'init' # ordinarily set in base routes.py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L8_C0", "label": "default_controller =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0402, 0.005, 0, 0.66, 0.1111, 335, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_controller", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "default_controller = 'default' # ordinarily set in app-specific routes.py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L9_C0", "label": "default_function =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0452, 0.005, 0, 0.66, 0.2222, 625, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "default_function = 'index' # ordinarily set in app-specific routes.py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L19_C0", "label": "routes_app =", "type": "assigned_variable", "loc": [19, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1005, 0.0151, 0, 0.66, 0.3333, 116, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "routes_app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "routes_app = ((r'/(?P<app>welcome|admin|app)\\b.*', r'\\g<app>'),\n (r'(.*)', r'myapp'),\n (r'/?(.*)', r'myapp'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L33_C0", "label": "BASE =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.1658, 0.005, 0, 0.66, 0.4444, 315, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BASE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BASE = '' # optonal prefix for incoming URLs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L35_C0", "label": "routes_in =", "type": "assigned_variable", "loc": [35, 51], "level": 0, "parent": null, "vector": [14, 0, 0.2161, 0.0854, 0, 0.66, 0.5556, 545, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "routes_in", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "routes_in = (\n # do not reroute admin unless you want to disable it\n (BASE + '/admin', '/admin/default/index'),\n (BASE + '/admin/$anything', '/admin/$anything'),\n # do not reroute appadmin unless you want to disable it\n (BASE + '/$app/appadmin', '/$app/appadmin/index'),\n (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything'),\n # do not reroute static files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L57_C0", "label": "routes_out =", "type": "assigned_variable", "loc": [57, 69], "level": 0, "parent": null, "vector": [14, 0, 0.3166, 0.0653, 0, 0.66, 0.6667, 527, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "routes_out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "routes_out = (\n # do not reroute admin unless you want to disable it\n ('/admin/$anything', BASE + '/admin/$anything'),\n # do not reroute appadmin unless you want to disable it\n ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),\n # do not reroute static files\n ('/$app/static/$anything', BASE + '/$app/static/$anything'),\n # do other stuff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Assign_L76_C0", "label": "logging =", "type": "assigned_variable", "loc": [76, 76], "level": 0, "parent": null, "vector": [14, 0, 0.3819, 0.005, 0, 0.66, 0.7778, 715, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "logging = 'debug'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:FunctionDef_L115_C0", "label": "__routes_doctest", "type": "function", "loc": [115, 195], "level": 0, "parent": null, "vector": [2, 0, 0.7789, 0.407, 0, 0.66, 0.8889, 406, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__routes_doctest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def __routes_doctest():\n '''\n Dummy function for doctesting routes.py.\n\n Use filter_url() to test incoming or outgoing routes;\n filter_err() for error redirection.\n\n filter_url() accepts overrides for method and remote host:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Expr_L116_C4", "label": "expression", "type": "expression", "loc": [116, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_766:FunctionDef_L115_C0", "vector": [8, 1, 0.7789, 0.397, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Dummy function for doctesting routes.py.\n\n Use filter_url() to test incoming or outgoing routes;\n filter_err() for error redirection.\n\n filter_url() accepts overrides for method and remote host:\n filter_url(url, method='get', remote='0.0.0.0', out=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "label": "if", "type": "if", "loc": [197, 199], "level": 0, "parent": null, "vector": [4, 0, 0.995, 0.0151, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n import doctest\n doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Import_L198_C4", "label": "doctest import doctest", "type": "import", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "vector": [1, 1, 0.995, 0.005, 1, 0.93, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_766:Expr_L199_C4", "label": "testmod()", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "vector": [8, 1, 1.0, 0.005, 1, 0.93, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_766:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_766:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_766:Import_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_766:If_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_766:Expr_L199_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if '__file__' in globals():
path = os.path.dirname(os.path.abspath(__file__))
elif hasattr(sys, 'frozen'):
path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe
else: # should never happen
path = os.getcwd()
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
# import gluon.import_all ##### This should be uncommented for py2exe.py
import gluon.widget
# Start Web2py and Web2py cron service!
if __name__ == '__main__':
try:
from multiprocessing import freeze_support
freeze_support()
except:
sys.stderr.write('Sorry, -K only supported for python 2.6-2.7\n')
if os.environ.has_key("COVERAGE_PROCESS_START"):
try:
import coverage
coverage.process_startup()
except:
pass
gluon.widget.start(cron=True)
| ajibawa-2023/Python-Code-Large/train/row_767 | 20 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_767:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1212, 0.0303, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1515, 0.0303, 0, 0.66, 0.1667, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "label": "if", "type": "if", "loc": [7, 12], "level": 0, "parent": null, "vector": [4, 0, 0.2879, 0.1818, 0, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if '__file__' in globals():\n path = os.path.dirname(os.path.abspath(__file__))\nelif hasattr(sys, 'frozen'):\n path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe\nelse: # should never happen\n path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L8_C4", "label": "path = dirname()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "vector": [14, 1, 0.2424, 0.0303, 1, 0.84, 0.0, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", "label": "if", "type": "if", "loc": [9, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "vector": [4, 1, 0.3182, 0.1212, 1, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif hasattr(sys, 'frozen'):\n path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe\nelse: # should never happen\n path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L10_C4", "label": "path = dirname()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", "vector": [14, 2, 0.303, 0.0303, 2, 0.77, 0.0, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " path = os.path.dirname(os.path.abspath(sys.executable)) # for py2exe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L12_C4", "label": "path = getcwd()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", "vector": [14, 2, 0.3636, 0.0303, 2, 0.77, 1.0, 358, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L13_C0", "label": "chdir()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.3939, 0.0303, 0, 0.66, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L15_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.4545, 0.0303, 0, 0.66, 0.6667, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Import_L18_C0", "label": "gluon.widget import gluon.widget", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0303, 0, 0.66, 0.8333, 624, 0, 1, 0, 0, 624, 0, 0], "semantic": {"name": "gluon.widget", "arg_names": [], "import_names": ["gluon.widget"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.widget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "label": "if", "type": "if", "loc": [21, 33], "level": 0, "parent": null, "vector": [4, 0, 0.8182, 0.3939, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n try:\n from multiprocessing import freeze_support\n freeze_support()\n except:\n sys.stderr.write('Sorry, -K only supported for python 2.6-2.7\\n')\n if os.environ.has_key(\"COVERAGE_PROCESS_START\"):\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "label": "try", "type": "try", "loc": [22, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "vector": [7, 1, 0.7273, 0.1515, 1, 0.71, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from multiprocessing import freeze_support\n freeze_support()\n except:\n sys.stderr.write('Sorry, -K only supported for python 2.6-2.7\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:ImportFrom_L23_C8", "label": "from multiprocessing import freeze_support", "type": "import", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "vector": [1, 2, 0.697, 0.0303, 2, 0.76, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "multiprocessing", "arg_names": [], "import_names": ["freeze_support"], "rhs_call_name": "", "annotation": ""}, "snippet": " from multiprocessing import freeze_support"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L24_C8", "label": "freeze_support()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "vector": [8, 2, 0.7273, 0.0303, 2, 0.76, 1.0, 241, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "freeze_support", "arg_names": [], "import_names": [], "rhs_call_name": "freeze_support", "annotation": ""}, "snippet": " freeze_support()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L26_C8", "label": "write()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "vector": [8, 2, 0.7879, 0.0303, 2, 0.76, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write('Sorry, -K only supported for python 2.6-2.7\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:If_L27_C4", "label": "if", "type": "if", "loc": [27, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "vector": [4, 1, 0.8939, 0.1818, 1, 0.71, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.environ.has_key(\"COVERAGE_PROCESS_START\"):\n try:\n import coverage\n coverage.process_startup()\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L27_C4", "vector": [7, 2, 0.9091, 0.1515, 2, 0.65, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import coverage\n coverage.process_startup()\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Import_L29_C12", "label": "coverage import coverage", "type": "import", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8", "vector": [1, 3, 0.8788, 0.0303, 3, 0.62, 0.0, 940, 0, 1, 0, 0, 940, 0, 0], "semantic": {"name": "coverage", "arg_names": [], "import_names": ["coverage"], "rhs_call_name": "", "annotation": ""}, "snippet": " import coverage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L30_C12", "label": "process_startup()", "type": "expression", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8", "vector": [8, 3, 0.9091, 0.0303, 3, 0.62, 1.0, 142, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process_startup", "arg_names": [], "import_names": [], "rhs_call_name": "process_startup", "annotation": ""}, "snippet": " coverage.process_startup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L33_C4", "label": "start()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.71, 1.0, 511, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " gluon.widget.start(cron=True)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_767:ImportFrom_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Import_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_767:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_767:Expr_L33_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
##############################################################################
# Configuration parameters for Google App Engine
##############################################################################
LOG_STATS = False # web2py level log statistics
APPSTATS = True # GAE level usage statistics and profiling
DEBUG = False # debug mode
#
# Read more about APPSTATS here
# http://googleappengine.blogspot.com/2010/03/easy-performance-profiling-with.html
# can be accessed from:
# http://localhost:8080/_ah/stats
##############################################################################
# All tricks in this file developed by Robin Bhattacharyya
##############################################################################
import time
import os
import sys
import logging
import cPickle
import pickle
import wsgiref.handlers
import datetime
path = os.path.dirname(os.path.abspath(__file__))
sys.path = [path] + [p for p in sys.path if not p == path]
sys.modules['cPickle'] = sys.modules['pickle']
from gluon.settings import global_settings
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
global_settings.web2py_runtime_gae = True
global_settings.db_sessions = True
if os.environ.get('SERVER_SOFTWARE', '').startswith('Devel'):
(global_settings.web2py_runtime, DEBUG) = \
('gae:development', True)
else:
(global_settings.web2py_runtime, DEBUG) = \
('gae:production', False)
import gluon.main
def log_stats(fun):
"""Function that will act as a decorator to make logging"""
def newfun(env, res):
"""Log the execution time of the passed function"""
timer = lambda t: (t.time(), t.clock())
(t0, c0) = timer(time)
executed_function = fun(env, res)
(t1, c1) = timer(time)
log_info = """**** Request: %.2fms/%.2fms (real time/cpu time)"""
log_info = log_info % ((t1 - t0) * 1000, (c1 - c0) * 1000)
logging.info(log_info)
return executed_function
return newfun
logging.basicConfig(level=logging.INFO)
def wsgiapp(env, res):
"""Return the wsgiapp"""
env['PATH_INFO'] = env['PATH_INFO'].decode('latin1').encode('utf8')
#when using the blobstore image uploader GAE dev SDK passes these as unicode
# they should be regular strings as they are parts of URLs
env['wsgi.url_scheme'] = str(env['wsgi.url_scheme'])
env['QUERY_STRING'] = str(env['QUERY_STRING'])
env['SERVER_NAME'] = str(env['SERVER_NAME'])
#this deals with a problem where GAE development server seems to forget
# the path between requests
if global_settings.web2py_runtime == 'gae:development':
gluon.admin.create_missing_folders()
web2py_path = global_settings.applications_parent # backward compatibility
return gluon.main.wsgibase(env, res)
if LOG_STATS or DEBUG:
wsgiapp = log_stats(wsgiapp)
def main():
"""Run the wsgi app"""
run_wsgi_app(wsgiapp)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_768 | 55 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0566, 0.0472, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L13_C0", "label": "LOG_STATS =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1226, 0.0094, 0, 0.66, 0.037, 779, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "LOG_STATS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOG_STATS = False # web2py level log statistics"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L14_C0", "label": "APPSTATS =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.1321, 0.0094, 0, 0.66, 0.0741, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "APPSTATS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "APPSTATS = True # GAE level usage statistics and profiling"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L15_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1415, 0.0094, 0, 0.66, 0.1111, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEBUG = False # debug mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L26_C0", "label": "time import time", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.2453, 0.0094, 0, 0.66, 0.1481, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L27_C0", "label": "os import os", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2547, 0.0094, 0, 0.66, 0.1852, 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_768:Import_L28_C0", "label": "sys import sys", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.2642, 0.0094, 0, 0.66, 0.2222, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L29_C0", "label": "logging import logging", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.2736, 0.0094, 0, 0.66, 0.2593, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L30_C0", "label": "cPickle import cPickle", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.283, 0.0094, 0, 0.66, 0.2963, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["cPickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L31_C0", "label": "pickle import pickle", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2925, 0.0094, 0, 0.66, 0.3333, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L32_C0", "label": "wsgiref.handlers import wsgiref.handlers", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.3019, 0.0094, 0, 0.66, 0.3704, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "wsgiref.handlers", "arg_names": [], "import_names": ["wsgiref.handlers"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wsgiref.handlers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L33_C0", "label": "datetime import datetime", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.3113, 0.0094, 0, 0.66, 0.4074, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L35_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3302, 0.0094, 0, 0.66, 0.4444, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L36_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.3396, 0.0094, 0, 0.66, 0.4815, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L38_C0", "label": "assign", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.3585, 0.0094, 0, 0.66, 0.5185, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.modules['cPickle'] = sys.modules['pickle']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:ImportFrom_L41_C0", "label": "from gluon.settings import global_settings", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.3868, 0.0094, 0, 0.66, 0.5556, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:ImportFrom_L42_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [42, 42], "level": 0, "parent": null, "vector": [1, 0, 0.3962, 0.0094, 0, 0.66, 0.5926, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:ImportFrom_L43_C0", "label": "from google.appengine.ext.webapp.util import run_wsgi_app", "type": "import", "loc": [43, 43], "level": 0, "parent": null, "vector": [1, 0, 0.4057, 0.0094, 0, 0.66, 0.6296, 327, 0, 1, 0, 0, 327, 0, 0], "semantic": {"name": "google.appengine.ext.webapp.util", "arg_names": [], "import_names": ["run_wsgi_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp.util import run_wsgi_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L46_C0", "label": "global_settings.web2py_runtime_gae =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.434, 0.0094, 0, 0.66, 0.6667, 809, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "global_settings.web2py_runtime_gae", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.web2py_runtime_gae = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L47_C0", "label": "global_settings.db_sessions =", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.4434, 0.0094, 0, 0.66, 0.7037, 938, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "global_settings.db_sessions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.db_sessions = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "label": "if", "type": "if", "loc": [48, 53], "level": 0, "parent": null, "vector": [4, 0, 0.4764, 0.0566, 0, 0.66, 0.7407, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os.environ.get('SERVER_SOFTWARE', '').startswith('Devel'):\n (global_settings.web2py_runtime, DEBUG) = \\\n ('gae:development', True)\nelse:\n (global_settings.web2py_runtime, DEBUG) = \\\n ('gae:production', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L49_C4", "label": "DEBUG =", "type": "assigned_variable", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "vector": [14, 1, 0.467, 0.0189, 1, 0.56, 0.0, 309, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (global_settings.web2py_runtime, DEBUG) = \\\n ('gae:development', True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L52_C4", "label": "DEBUG =", "type": "assigned_variable", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "vector": [14, 1, 0.4953, 0.0189, 1, 0.56, 1.0, 309, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (global_settings.web2py_runtime, DEBUG) = \\\n ('gae:production', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Import_L56_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [56, 56], "level": 0, "parent": null, "vector": [1, 0, 0.5283, 0.0094, 0, 0.66, 0.7778, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "label": "log_stats", "type": "function", "loc": [59, 71], "level": 0, "parent": null, "vector": [2, 0, 0.6132, 0.1226, 0, 0.66, 0.8148, 740, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "log_stats", "arg_names": ["fun"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def log_stats(fun):\n \"\"\"Function that will act as a decorator to make logging\"\"\"\n def newfun(env, res):\n \"\"\"Log the execution time of the passed function\"\"\"\n timer = lambda t: (t.time(), t.clock())\n (t0, c0) = timer(time)\n executed_function = fun(env, res)\n (t1, c1) = timer(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L60_C4", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "vector": [8, 1, 0.566, 0.0094, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Function that will act as a decorator to make logging\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "label": "newfun", "type": "function", "loc": [61, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "vector": [2, 1, 0.6179, 0.0943, 1, 0.66, 0.5, 98, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "newfun", "arg_names": ["env", "res"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def newfun(env, res):\n \"\"\"Log the execution time of the passed function\"\"\"\n timer = lambda t: (t.time(), t.clock())\n (t0, c0) = timer(time)\n executed_function = fun(env, res)\n (t1, c1) = timer(time)\n log_info = \"\"\"**** Request: %.2fms/%.2fms (real time/cpu time)\"\"\"\n log_info = log_info % ((t1 - t0) * 1000, (c1 - c0) * 1000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L62_C8", "label": "expression", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [8, 2, 0.5849, 0.0094, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Log the execution time of the passed function\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L63_C8", "label": "timer =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.5943, 0.0094, 2, 0.74, 0.125, 541, 9, 0, 0, 0, 0, 0, 2], "semantic": {"name": "timer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timer = lambda t: (t.time(), t.clock())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L64_C8", "label": "t0, c0 = timer()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.6038, 0.0094, 2, 0.74, 0.25, 553, 3, 1, 0, 0, 541, 10, 1], "semantic": {"name": "t0, c0", "arg_names": [], "import_names": [], "rhs_call_name": "timer", "annotation": ""}, "snippet": " (t0, c0) = timer(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L65_C8", "label": "executed_function = fun()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.6132, 0.0094, 2, 0.74, 0.375, 976, 3, 2, 0, 0, 744, 10, 1], "semantic": {"name": "executed_function", "arg_names": [], "import_names": [], "rhs_call_name": "fun", "annotation": ""}, "snippet": " executed_function = fun(env, res)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L66_C8", "label": "t1, c1 = timer()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.6226, 0.0094, 2, 0.74, 0.5, 946, 3, 1, 0, 0, 541, 10, 1], "semantic": {"name": "t1, c1", "arg_names": [], "import_names": [], "rhs_call_name": "timer", "annotation": ""}, "snippet": " (t1, c1) = timer(time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L67_C8", "label": "log_info =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.6321, 0.0094, 2, 0.74, 0.625, 165, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "log_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " log_info = \"\"\"**** Request: %.2fms/%.2fms (real time/cpu time)\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L68_C8", "label": "log_info =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [14, 2, 0.6415, 0.0094, 2, 0.74, 0.75, 165, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "log_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " log_info = log_info % ((t1 - t0) * 1000, (c1 - c0) * 1000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L69_C8", "label": "info()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [8, 2, 0.6509, 0.0094, 2, 0.74, 0.875, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info(log_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "vector": [13, 2, 0.6604, 0.0094, 2, 0.74, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return executed_function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L71_C4", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "vector": [13, 1, 0.6698, 0.0094, 1, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newfun"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L74_C0", "label": "basicConfig()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 0.6981, 0.0094, 0, 0.66, 0.8519, 256, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "basicConfig", "arg_names": [], "import_names": [], "rhs_call_name": "basicConfig", "annotation": ""}, "snippet": "logging.basicConfig(level=logging.INFO)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "label": "wsgiapp", "type": "function", "loc": [77, 94], "level": 0, "parent": null, "vector": [2, 0, 0.8066, 0.1698, 0, 0.66, 0.8889, 688, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "wsgiapp", "arg_names": ["env", "res"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wsgiapp(env, res):\n \"\"\"Return the wsgiapp\"\"\"\n env['PATH_INFO'] = env['PATH_INFO'].decode('latin1').encode('utf8')\n\n #when using the blobstore image uploader GAE dev SDK passes these as unicode\n # they should be regular strings as they are parts of URLs\n env['wsgi.url_scheme'] = str(env['wsgi.url_scheme'])\n env['QUERY_STRING'] = str(env['QUERY_STRING'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L78_C4", "label": "expression", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [8, 1, 0.7358, 0.0094, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the wsgiapp\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L79_C4", "label": " = encode()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [14, 1, 0.7453, 0.0094, 1, 0.2, 0.1429, 0, 3, 1, 0, 0, 623, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " env['PATH_INFO'] = env['PATH_INFO'].decode('latin1').encode('utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L83_C4", "label": " = str()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [14, 1, 0.783, 0.0094, 1, 0.2, 0.2857, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " env['wsgi.url_scheme'] = str(env['wsgi.url_scheme'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L84_C4", "label": " = str()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [14, 1, 0.7925, 0.0094, 1, 0.2, 0.4286, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " env['QUERY_STRING'] = str(env['QUERY_STRING'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L85_C4", "label": " = str()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [14, 1, 0.8019, 0.0094, 1, 0.2, 0.5714, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " env['SERVER_NAME'] = str(env['SERVER_NAME'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:If_L89_C4", "label": "if", "type": "if", "loc": [89, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [4, 1, 0.8443, 0.0189, 1, 0.2, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if global_settings.web2py_runtime == 'gae:development':\n gluon.admin.create_missing_folders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L90_C8", "label": "create_missing_folders()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:If_L89_C4", "vector": [8, 2, 0.8491, 0.0094, 2, 0.5, 0.0, 243, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create_missing_folders", "arg_names": [], "import_names": [], "rhs_call_name": "create_missing_folders", "annotation": ""}, "snippet": " gluon.admin.create_missing_folders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L92_C4", "label": "web2py_path =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [14, 1, 0.8679, 0.0094, 1, 0.2, 0.8571, 576, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "web2py_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " web2py_path = global_settings.applications_parent # backward compatibility"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L94_C4", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "vector": [13, 1, 0.8868, 0.0094, 1, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return gluon.main.wsgibase(env, res)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:If_L97_C0", "label": "if", "type": "if", "loc": [97, 98], "level": 0, "parent": null, "vector": [4, 0, 0.9198, 0.0189, 0, 0.66, 0.9259, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if LOG_STATS or DEBUG:\n wsgiapp = log_stats(wsgiapp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L98_C4", "label": "wsgiapp = log_stats()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:If_L97_C0", "vector": [14, 1, 0.9245, 0.0094, 1, 0.4, 0.0, 688, 3, 1, 0, 0, 740, 10, 1], "semantic": {"name": "wsgiapp", "arg_names": [], "import_names": [], "rhs_call_name": "log_stats", "annotation": ""}, "snippet": " wsgiapp = log_stats(wsgiapp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L101_C0", "label": "main", "type": "function", "loc": [101, 103], "level": 0, "parent": null, "vector": [2, 0, 0.9623, 0.0283, 0, 0.66, 0.963, 624, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n \"\"\"Run the wsgi app\"\"\"\n run_wsgi_app(wsgiapp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L102_C4", "label": "expression", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L101_C0", "vector": [8, 1, 0.9623, 0.0094, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Run the wsgi app\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L103_C4", "label": "run_wsgi_app()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L101_C0", "vector": [8, 1, 0.9717, 0.0094, 1, 0.2, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " run_wsgi_app(wsgiapp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:If_L105_C0", "label": "if", "type": "if", "loc": [105, 106], "level": 0, "parent": null, "vector": [4, 0, 0.9953, 0.0189, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L106_C4", "label": "main()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_768:If_L105_C0", "vector": [8, 1, 1.0, 0.0094, 1, 0.06, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Return_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_768:If_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_768:Expr_L106_C4"}] |
import logging
logger = logging.getLogger('x90-analyze')
logger.setLevel(logging.DEBUG)
# File Handler
hdlr = logging.FileHandler('logs/run.log')
formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
hdlr.setLevel(logging.DEBUG)
# Stream handler
ch = logging.StreamHandler()
formatter = logging.Formatter('[%(levelname)s] %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
ch.setLevel(logging.INFO)
def printerror (msg):
logger.error(msg)
def printwarning (msg):
logger.warning(msg)
def printinfo (msg):
logger.info(msg)
| ajibawa-2023/Python-Code-Large/train/row_769 | 19 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_769:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Assign_L3_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1111, 0.037, 0, 0.66, 0.0667, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger('x90-analyze')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L4_C0", "label": "setLevel()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1481, 0.037, 0, 0.66, 0.1333, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "logger.setLevel(logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Assign_L7_C0", "label": "hdlr = FileHandler()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.2593, 0.037, 0, 0.66, 0.2, 149, 3, 1, 0, 0, 306, 10, 1], "semantic": {"name": "hdlr", "arg_names": [], "import_names": [], "rhs_call_name": "FileHandler", "annotation": ""}, "snippet": "hdlr = logging.FileHandler('logs/run.log')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Assign_L8_C0", "label": "formatter = Formatter()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2963, 0.037, 0, 0.66, 0.2667, 791, 3, 1, 0, 0, 766, 10, 1], "semantic": {"name": "formatter", "arg_names": [], "import_names": [], "rhs_call_name": "Formatter", "annotation": ""}, "snippet": "formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L9_C0", "label": "setFormatter()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.3333, 0.037, 0, 0.66, 0.3333, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "hdlr.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L10_C0", "label": "addHandler()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.3704, 0.037, 0, 0.66, 0.4, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "logger.addHandler(hdlr) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L11_C0", "label": "setLevel()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.4074, 0.037, 0, 0.66, 0.4667, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "hdlr.setLevel(logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Assign_L14_C0", "label": "ch = StreamHandler()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.5185, 0.037, 0, 0.66, 0.5333, 263, 3, 0, 0, 0, 514, 10, 1], "semantic": {"name": "ch", "arg_names": [], "import_names": [], "rhs_call_name": "StreamHandler", "annotation": ""}, "snippet": "ch = logging.StreamHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Assign_L15_C0", "label": "formatter = Formatter()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.5556, 0.037, 0, 0.66, 0.6, 791, 3, 1, 0, 0, 766, 10, 1], "semantic": {"name": "formatter", "arg_names": [], "import_names": [], "rhs_call_name": "Formatter", "annotation": ""}, "snippet": "formatter = logging.Formatter('[%(levelname)s] %(message)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L16_C0", "label": "setFormatter()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.5926, 0.037, 0, 0.66, 0.6667, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "ch.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L17_C0", "label": "addHandler()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.6296, 0.037, 0, 0.66, 0.7333, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "logger.addHandler(ch) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L18_C0", "label": "setLevel()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.037, 0, 0.66, 0.8, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "ch.setLevel(logging.INFO)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L20_C0", "label": "printerror", "type": "function", "loc": [20, 21], "level": 0, "parent": null, "vector": [2, 0, 0.7593, 0.0741, 0, 0.66, 0.8667, 562, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": ["msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printerror (msg):\n\tlogger.error(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L21_C1", "label": "error()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L20_C0", "vector": [8, 1, 0.7778, 0.037, 1, 0.55, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\tlogger.error(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L23_C0", "label": "printwarning", "type": "function", "loc": [23, 24], "level": 0, "parent": null, "vector": [2, 0, 0.8704, 0.0741, 0, 0.66, 0.9333, 543, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printwarning", "arg_names": ["msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printwarning (msg):\n\tlogger.warning(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L24_C1", "label": "warning()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L23_C0", "vector": [8, 1, 0.8889, 0.037, 1, 0.87, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\tlogger.warning(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L26_C0", "label": "printinfo", "type": "function", "loc": [26, 27], "level": 0, "parent": null, "vector": [2, 0, 0.9815, 0.0741, 0, 0.66, 1.0, 989, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": ["msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printinfo (msg):\n\tlogger.info(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L27_C1", "label": "info()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L26_C0", "vector": [8, 1, 1.0, 0.037, 1, 0.05, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\tlogger.info(msg)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_769:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_769:Expr_L27_C1"}] |
import os
import re
import shutil
import commands
import _mysql
import hashlib
import logger
# Analyze project.
def analyze_metrics(project, revision, url, db, folder):
analyze_code_metrics(project, revision, url, db, folder)
analyze_filemetrics(project, revision, url, db, folder)
# Get code metrics:
def analyze_code_metrics(project, revision, url, db, folder):
logger.printinfo("Analyzing code")
phand = os.popen("cloc "+folder)
# read output from the command
while 1:
line = phand.readline()
if line == "": break
# Find the sum of the code calculations with regex.
m = re.search('SUM:.*?(?P<FILES>[0-9]+).*? (?P<BLANK>[0-9]+).*? (?P<COMMENT>[0-9]+).*? (?P<CODE>[0-9]+)', line)
if m is not None:
files = m.group("FILES")
blank = m.group("BLANK")
comment = m.group("COMMENT")
code = m.group("CODE")
db.insertmetric(project, revision, url, files, blank, comment, code)
phand.close()
return
phand.close()
return
# Code metrics by file:
def analyze_filemetrics (project, revision, url, db, folder):
logger.printinfo("Analyzing files")
phand = os.popen("cloc --by-file --sql=1 " + folder)
# read output from the command
while 1:
line = phand.readline()
if line == "": break
m = re.search('\',\ \'(?P<LANG>.*?)\',\ \'(?P<FILE>.*?)\',\ (?P<BLANK>[0-9]+),\ (?P<COMMENT>[0-9]+),\ (?P<CODE>[0-9]+),\ ', line)
if m is not None:
filename = m.group("FILE");
blank = m.group("BLANK");
comment = m.group("COMMENT");
code = m.group("CODE");
lang = m.group("LANG");
db.insertfilemetric(project, revision, url, filename, blank, comment, code, lang)
phand.close()
| ajibawa-2023/Python-Code-Large/train/row_770 | 42 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L2_C0", "label": "re import re", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0351, 0.0175, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L3_C0", "label": "shutil import shutil", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0175, 0, 0.66, 0.2222, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L4_C0", "label": "commands import commands", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0702, 0.0175, 0, 0.66, 0.3333, 760, 0, 1, 0, 0, 760, 0, 0], "semantic": {"name": "commands", "arg_names": [], "import_names": ["commands"], "rhs_call_name": "", "annotation": ""}, "snippet": "import commands"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L5_C0", "label": "_mysql import _mysql", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0877, 0.0175, 0, 0.66, 0.4444, 880, 0, 1, 0, 0, 880, 0, 0], "semantic": {"name": "_mysql", "arg_names": [], "import_names": ["_mysql"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _mysql"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L6_C0", "label": "hashlib import hashlib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0175, 0, 0.66, 0.5556, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Import_L7_C0", "label": "logger import logger", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1228, 0.0175, 0, 0.66, 0.6667, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "logger", "arg_names": [], "import_names": ["logger"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "label": "analyze_metrics", "type": "function", "loc": [10, 12], "level": 0, "parent": null, "vector": [2, 0, 0.193, 0.0526, 0, 0.66, 0.7778, 351, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "analyze_metrics", "arg_names": ["project", "revision", "url", "db", "folder"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def analyze_metrics(project, revision, url, db, folder):\n\tanalyze_code_metrics(project, revision, url, db, folder)\n\tanalyze_filemetrics(project, revision, url, db, folder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L11_C1", "label": "analyze_code_metrics()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "vector": [8, 1, 0.193, 0.0175, 1, 0.69, 0.0, 415, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "analyze_code_metrics", "arg_names": [], "import_names": [], "rhs_call_name": "analyze_code_metrics", "annotation": ""}, "snippet": "\tanalyze_code_metrics(project, revision, url, db, folder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L12_C1", "label": "analyze_filemetrics()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "vector": [8, 1, 0.2105, 0.0175, 1, 0.69, 1.0, 23, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "analyze_filemetrics", "arg_names": [], "import_names": [], "rhs_call_name": "analyze_filemetrics", "annotation": ""}, "snippet": "\tanalyze_filemetrics(project, revision, url, db, folder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "label": "analyze_code_metrics", "type": "function", "loc": [15, 36], "level": 0, "parent": null, "vector": [2, 0, 0.4474, 0.386, 0, 0.66, 0.8889, 415, 0, 5, 0, 0, 0, 0, 11], "semantic": {"name": "analyze_code_metrics", "arg_names": ["project", "revision", "url", "db", "folder"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def analyze_code_metrics(project, revision, url, db, folder):\n\tlogger.printinfo(\"Analyzing code\")\n\tphand = os.popen(\"cloc \"+folder)\n\n\t# read output from the command\n\twhile 1:\n\t\tline = phand.readline()\n\t\tif line == \"\": break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L16_C1", "label": "printinfo()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "vector": [8, 1, 0.2807, 0.0175, 1, 0.07, 0.0, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "\tlogger.printinfo(\"Analyzing code\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L17_C1", "label": "phand = popen()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "vector": [14, 1, 0.2982, 0.0175, 1, 0.07, 0.25, 947, 3, 1, 0, 0, 221, 10, 1], "semantic": {"name": "phand", "arg_names": [], "import_names": [], "rhs_call_name": "popen", "annotation": ""}, "snippet": "\tphand = os.popen(\"cloc \"+folder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "label": "while", "type": "while", "loc": [20, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "vector": [5, 1, 0.4649, 0.2456, 1, 0.07, 0.5, 0, 1, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile 1:\n\t\tline = phand.readline()\n\t\tif line == \"\": break\n\t\t# Find the sum of the code calculations with regex.\n\t\tm = re.search('SUM:.*?(?P<FILES>[0-9]+).*? (?P<BLANK>[0-9]+).*? (?P<COMMENT>[0-9]+).*? (?P<CODE>[0-9]+)', line)\n\t\tif m is not None:\n\t\t\tfiles \t= m.group(\"FILES\")\n\t\t\tblank \t= m.group(\"BLANK\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L21_C2", "label": "line = readline()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "vector": [14, 2, 0.3684, 0.0175, 2, 0.69, 0.0, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\tline = phand.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:If_L22_C2", "label": "if", "type": "if", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "vector": [4, 2, 0.386, 0.0175, 2, 0.69, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif line == \"\": break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L24_C2", "label": "m = search()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "vector": [14, 2, 0.4211, 0.0175, 2, 0.69, 0.6667, 711, 3, 2, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": "\t\tm = re.search('SUM:.*?(?P<FILES>[0-9]+).*? (?P<BLANK>[0-9]+).*? (?P<COMMENT>[0-9]+).*? (?P<CODE>[0-9]+)', line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "label": "if", "type": "if", "loc": [25, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "vector": [4, 2, 0.5088, 0.1579, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif m is not None:\n\t\t\tfiles \t= m.group(\"FILES\")\n\t\t\tblank \t= m.group(\"BLANK\")\n\t\t\tcomment = m.group(\"COMMENT\")\n\t\t\tcode \t= m.group(\"CODE\")\n\t\t\n\t\t\tdb.insertmetric(project, revision, url, files, blank, comment, code)\n\t\t\tphand.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L26_C3", "label": "files = group()", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [14, 3, 0.4561, 0.0175, 3, 0.72, 0.0, 598, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tfiles \t= m.group(\"FILES\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L27_C3", "label": "blank = group()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [14, 3, 0.4737, 0.0175, 3, 0.72, 0.1667, 14, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "blank", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tblank \t= m.group(\"BLANK\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L28_C3", "label": "comment = group()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [14, 3, 0.4912, 0.0175, 3, 0.72, 0.3333, 34, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tcomment = m.group(\"COMMENT\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L29_C3", "label": "code = group()", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [14, 3, 0.5088, 0.0175, 3, 0.72, 0.5, 44, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tcode \t= m.group(\"CODE\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L31_C3", "label": "insertmetric()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [8, 3, 0.5439, 0.0175, 3, 0.72, 0.6667, 349, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "insertmetric", "arg_names": [], "import_names": [], "rhs_call_name": "insertmetric", "annotation": ""}, "snippet": "\t\t\tdb.insertmetric(project, revision, url, files, blank, comment, code)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L32_C3", "label": "close()", "type": "expression", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [8, 3, 0.5614, 0.0175, 3, 0.72, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\t\tphand.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Return_L33_C3", "label": "return", "type": "return", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "vector": [13, 3, 0.5789, 0.0175, 3, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L35_C1", "label": "close()", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "vector": [8, 1, 0.614, 0.0175, 1, 0.07, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tphand.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Return_L36_C1", "label": "return", "type": "return", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "vector": [13, 1, 0.6316, 0.0175, 1, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "label": "analyze_filemetrics", "type": "function", "loc": [39, 57], "level": 0, "parent": null, "vector": [2, 0, 0.8421, 0.3333, 0, 0.66, 1.0, 23, 0, 5, 0, 0, 0, 0, 11], "semantic": {"name": "analyze_filemetrics", "arg_names": ["project", "revision", "url", "db", "folder"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def analyze_filemetrics (project, revision, url, db, folder):\n\tlogger.printinfo(\"Analyzing files\")\n\tphand = os.popen(\"cloc --by-file --sql=1 \" + folder)\n\n\t# read output from the command\n\twhile 1:\n\t\tline = phand.readline()\n\t\tif line == \"\": break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L40_C1", "label": "printinfo()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "vector": [8, 1, 0.7018, 0.0175, 1, 0.89, 0.0, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "\tlogger.printinfo(\"Analyzing files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L41_C1", "label": "phand = popen()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "vector": [14, 1, 0.7193, 0.0175, 1, 0.89, 0.3333, 947, 3, 1, 0, 0, 221, 10, 1], "semantic": {"name": "phand", "arg_names": [], "import_names": [], "rhs_call_name": "popen", "annotation": ""}, "snippet": "\tphand = os.popen(\"cloc --by-file --sql=1 \" + folder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "label": "while", "type": "while", "loc": [44, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "vector": [5, 1, 0.8684, 0.2105, 1, 0.89, 0.6667, 0, 1, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\twhile 1:\n\t\tline = phand.readline()\n\t\tif line == \"\": break\n\t\tm = re.search('\\',\\ \\'(?P<LANG>.*?)\\',\\ \\'(?P<FILE>.*?)\\',\\ (?P<BLANK>[0-9]+),\\ (?P<COMMENT>[0-9]+),\\ (?P<CODE>[0-9]+),\\ ', line)\n\t\tif m is not None:\n\t\t\tfilename = m.group(\"FILE\");\n\t\t\tblank = m.group(\"BLANK\");\n\t\t\tcomment = m.group(\"COMMENT\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L45_C2", "label": "line = readline()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "vector": [14, 2, 0.7895, 0.0175, 2, 0.06, 0.0, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\tline = phand.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:If_L46_C2", "label": "if", "type": "if", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "vector": [4, 2, 0.807, 0.0175, 2, 0.06, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif line == \"\": break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L47_C2", "label": "m = search()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "vector": [14, 2, 0.8246, 0.0175, 2, 0.06, 0.6667, 711, 3, 2, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": "\t\tm = re.search('\\',\\ \\'(?P<LANG>.*?)\\',\\ \\'(?P<FILE>.*?)\\',\\ (?P<BLANK>[0-9]+),\\ (?P<COMMENT>[0-9]+),\\ (?P<CODE>[0-9]+),\\ ', line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "label": "if", "type": "if", "loc": [48, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "vector": [4, 2, 0.9035, 0.1404, 2, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif m is not None:\n\t\t\tfilename = m.group(\"FILE\");\n\t\t\tblank = m.group(\"BLANK\");\n\t\t\tcomment = m.group(\"COMMENT\");\n\t\t\tcode = m.group(\"CODE\");\n\t\t\tlang = m.group(\"LANG\");\n\n\t\t\tdb.insertfilemetric(project, revision, url, filename, blank, comment, code, lang)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L49_C3", "label": "filename = group()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [14, 3, 0.8596, 0.0175, 3, 0.61, 0.0, 275, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tfilename = m.group(\"FILE\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L50_C3", "label": "blank = group()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [14, 3, 0.8772, 0.0175, 3, 0.61, 0.2, 14, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "blank", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tblank = m.group(\"BLANK\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L51_C3", "label": "comment = group()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [14, 3, 0.8947, 0.0175, 3, 0.61, 0.4, 34, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tcomment = m.group(\"COMMENT\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L52_C3", "label": "code = group()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [14, 3, 0.9123, 0.0175, 3, 0.61, 0.6, 44, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tcode = m.group(\"CODE\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L53_C3", "label": "lang = group()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [14, 3, 0.9298, 0.0175, 3, 0.61, 0.8, 312, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "\t\t\tlang = m.group(\"LANG\");"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L55_C3", "label": "insertfilemetric()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "vector": [8, 3, 0.9649, 0.0175, 3, 0.61, 1.0, 308, 3, 8, 0, 0, 0, 0, 1], "semantic": {"name": "insertfilemetric", "arg_names": [], "import_names": [], "rhs_call_name": "insertfilemetric", "annotation": ""}, "snippet": "\t\t\tdb.insertfilemetric(project, revision, url, filename, blank, comment, code, lang)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L57_C1", "label": "close()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "vector": [8, 1, 1.0, 0.0175, 1, 0.89, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\tphand.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:If_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L20_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L26_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L27_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L28_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L29_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Return_L33_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L35_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Return_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:While_L44_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L49_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L50_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L51_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L52_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Assign_L53_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L55_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_770:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_770:Expr_L57_C1"}] |
##
## Mercurial-analyzer
##
## Todo: skriv om...
from xml.dom import minidom
import logger
## Parses a dom file
def parsedom(file):
try:
dom = minidom.parse(file)
except Exception:
logger.printerror("Failed to parse the xml file " + file);
exit()
return dom
class Project:
name="-noname-"
type="svn"
urls = []
def getprojects (file = 'settings/projects.xml'):
projects = [];
dom = parsedom(file)
logger.printinfo("Parsing project-settings")
try:
for node in dom.getElementsByTagName('project'):
proj = Project();
tmp = [];
for xnode in node.getElementsByTagName("name"):
proj.name = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("type"):
proj.type = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("url"):
tmp.append(xnode.firstChild.wholeText);
proj.urls = tmp;
projects.append(proj);
except Exception:
logger.printerror("Malformed xml elements")
exit()
return projects;
class DbSettings:
host=""
username=""
password=""
schema=""
def getdbsettings (file = 'settings/db.xml'):
logger.printinfo("Parsing database-settings")
dom = parsedom(file)
dbsetting = DbSettings()
try:
for node in dom.getElementsByTagName('database'):
for xnode in node.getElementsByTagName("host"):
dbsetting.host = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("username"):
dbsetting.username = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("password"):
dbsetting.password = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("schema"):
dbsetting.schema = xnode.firstChild.wholeText
except Exception:
logger.printerror("Malformed xml elements")
exit()
# Validate, or atleast check that variables have been changed...
if(dbsetting.host==""):
logger.printerror("Missing host")
exit()
if(dbsetting.username==""):
logger.printerror("Missing username")
exit()
if(dbsetting.password==""):
logger.printerror("Missing password")
exit()
if(dbsetting.schema==""):
logger.printerror("Missing schema")
exit()
return dbsetting;
class Type:
name="-noname-"
changelog=""
regex=""
checkout=""
def gettypes (file = 'settings/types.xml'):
types = {};
dom = parsedom(file)
logger.printinfo("Parsing supported vcs info")
try:
for node in dom.getElementsByTagName('type'):
proj = Type();
for xnode in node.getElementsByTagName("name"):
proj.name = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("changelog"):
proj.changelog = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("regex"):
proj.regex = xnode.firstChild.wholeText
for xnode in node.getElementsByTagName("checkout"):
proj.checkout = xnode.firstChild.wholeText
types[proj.name]=proj;
except Exception:
logger.printerror("Malformed xml elements")
exit()
return types;
| ajibawa-2023/Python-Code-Large/train/row_772 | 89 | 121 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_772:ImportFrom_L6_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0083, 0, 0.66, 0.0, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["minidom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import minidom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Import_L7_C0", "label": "logger import logger", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0579, 0.0083, 0, 0.66, 0.125, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "logger", "arg_names": [], "import_names": ["logger"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "label": "parsedom", "type": "function", "loc": [10, 17], "level": 0, "parent": null, "vector": [2, 0, 0.1116, 0.0661, 0, 0.66, 0.25, 642, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "parsedom", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parsedom(file):\n\ttry:\n\t\tdom = minidom.parse(file)\n\texcept Exception:\n\t logger.printerror(\"Failed to parse the xml file \" + file);\n\t exit()\n\n\treturn dom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "label": "try", "type": "try", "loc": [11, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "vector": [7, 1, 0.1074, 0.0413, 1, 0.8, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tdom = minidom.parse(file)\n\texcept Exception:\n\t logger.printerror(\"Failed to parse the xml file \" + file);\n\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L12_C2", "label": "dom = parse()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "vector": [14, 2, 0.0992, 0.0083, 2, 0.92, 0.0, 401, 3, 1, 0, 0, 678, 10, 1], "semantic": {"name": "dom", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": "\t\tdom = minidom.parse(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L14_C3", "label": "printerror()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "vector": [8, 2, 0.1157, 0.0083, 2, 0.92, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t logger.printerror(\"Failed to parse the xml file \" + file);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L15_C3", "label": "exit()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "vector": [8, 2, 0.124, 0.0083, 2, 0.92, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L17_C1", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "vector": [13, 1, 0.1405, 0.0083, 1, 0.8, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn dom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "label": "Project", "type": "class", "loc": [20, 23], "level": 0, "parent": null, "vector": [3, 0, 0.1777, 0.0331, 0, 0.66, 0.375, 740, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Project", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Project:\n\tname=\"-noname-\"\n\ttype=\"svn\"\n\turls = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L21_C1", "label": "name =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "vector": [14, 1, 0.1736, 0.0083, 1, 0.8, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tname=\"-noname-\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L22_C1", "label": "type =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "vector": [14, 1, 0.1818, 0.0083, 1, 0.8, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttype=\"svn\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L23_C1", "label": "urls =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "vector": [14, 1, 0.1901, 0.0083, 1, 0.8, 1.0, 260, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "urls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\turls = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "label": "getprojects", "type": "function", "loc": [25, 46], "level": 0, "parent": null, "vector": [2, 0, 0.2934, 0.1818, 0, 0.66, 0.5, 620, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "getprojects", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getprojects (file = 'settings/projects.xml'):\n\tprojects = [];\n\tdom = parsedom(file)\n\tlogger.printinfo(\"Parsing project-settings\")\n\ttry:\n\t\tfor node in dom.getElementsByTagName('project'):\n\t\t\tproj = Project();\n\t\t\ttmp = [];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L26_C1", "label": "projects =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "vector": [14, 1, 0.2149, 0.0083, 1, 0.39, 0.0, 324, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "projects", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tprojects = [];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L27_C1", "label": "dom = parsedom()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "vector": [14, 1, 0.2231, 0.0083, 1, 0.39, 0.25, 401, 3, 1, 0, 0, 642, 10, 1], "semantic": {"name": "dom", "arg_names": [], "import_names": [], "rhs_call_name": "parsedom", "annotation": ""}, "snippet": "\tdom = parsedom(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L28_C1", "label": "printinfo()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "vector": [8, 1, 0.2314, 0.0083, 1, 0.39, 0.5, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "\tlogger.printinfo(\"Parsing project-settings\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "label": "try", "type": "try", "loc": [29, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "vector": [7, 1, 0.3017, 0.1322, 1, 0.39, 0.75, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tfor node in dom.getElementsByTagName('project'):\n\t\t\tproj = Project();\n\t\t\ttmp = [];\n\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"type\"):\n\t\t\t\tproj.type = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "label": "for node", "type": "for", "loc": [30, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "vector": [6, 2, 0.2934, 0.0992, 2, 0.65, 0.0, 772, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor node in dom.getElementsByTagName('project'):\n\t\t\tproj = Project();\n\t\t\ttmp = [];\n\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"type\"):\n\t\t\t\tproj.type = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"url\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L31_C3", "label": "proj = Project()", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [14, 3, 0.2562, 0.0083, 3, 0.91, 0.0, 88, 3, 0, 0, 0, 740, 10, 1], "semantic": {"name": "proj", "arg_names": [], "import_names": [], "rhs_call_name": "Project", "annotation": ""}, "snippet": "\t\t\tproj = Project();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L32_C3", "label": "tmp =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [14, 3, 0.2645, 0.0083, 3, 0.91, 0.1667, 517, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttmp = [];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L33_C3", "label": "for xnode", "type": "for", "loc": [33, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [6, 3, 0.2769, 0.0165, 3, 0.91, 0.3333, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L34_C4", "label": "proj.name =", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L33_C3", "vector": [14, 4, 0.281, 0.0083, 4, 0.75, 0.0, 666, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.name = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L35_C3", "label": "for xnode", "type": "for", "loc": [35, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [6, 3, 0.2934, 0.0165, 3, 0.91, 0.5, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"type\"):\n\t\t\t\tproj.type = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L36_C4", "label": "proj.type =", "type": "assigned_variable", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L35_C3", "vector": [14, 4, 0.2975, 0.0083, 4, 0.24, 0.0, 671, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.type = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L37_C3", "label": "for xnode", "type": "for", "loc": [37, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [6, 3, 0.3099, 0.0165, 3, 0.91, 0.6667, 41, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"url\"):\n\t\t\t\ttmp.append(xnode.firstChild.wholeText);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L38_C4", "label": "append()", "type": "expression", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L37_C3", "vector": [8, 4, 0.314, 0.0083, 4, 0.18, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\ttmp.append(xnode.firstChild.wholeText);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L40_C3", "label": "proj.urls =", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [14, 3, 0.3306, 0.0083, 3, 0.91, 0.8333, 617, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.urls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tproj.urls = tmp;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L41_C3", "label": "append()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "vector": [8, 3, 0.3388, 0.0083, 3, 0.91, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\tprojects.append(proj);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L43_C4", "label": "printerror()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "vector": [8, 2, 0.3554, 0.0083, 2, 0.65, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Malformed xml elements\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L44_C4", "label": "exit()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "vector": [8, 2, 0.3636, 0.0083, 2, 0.65, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L46_C1", "label": "return", "type": "return", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "vector": [13, 1, 0.3802, 0.0083, 1, 0.39, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn projects;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "label": "DbSettings", "type": "class", "loc": [49, 53], "level": 0, "parent": null, "vector": [3, 0, 0.4215, 0.0413, 0, 0.66, 0.625, 562, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DbSettings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DbSettings:\n\thost=\"\"\n\tusername=\"\"\n\tpassword=\"\"\n\tschema=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L50_C1", "label": "host =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "vector": [14, 1, 0.4132, 0.0083, 1, 0.72, 0.0, 867, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\thost=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L51_C1", "label": "username =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "vector": [14, 1, 0.4215, 0.0083, 1, 0.72, 0.3333, 718, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tusername=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L52_C1", "label": "password =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "vector": [14, 1, 0.4298, 0.0083, 1, 0.72, 0.6667, 489, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tpassword=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L53_C1", "label": "schema =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "vector": [14, 1, 0.438, 0.0083, 1, 0.72, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "schema", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tschema=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "label": "getdbsettings", "type": "function", "loc": [55, 91], "level": 0, "parent": null, "vector": [2, 0, 0.6033, 0.3058, 0, 0.66, 0.75, 783, 0, 1, 1, 0, 0, 0, 18], "semantic": {"name": "getdbsettings", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getdbsettings (file = 'settings/db.xml'):\n\tlogger.printinfo(\"Parsing database-settings\")\n\tdom = parsedom(file)\n\tdbsetting = DbSettings()\n\n\ttry:\n\t\tfor node in dom.getElementsByTagName('database'):\n\t\t\tfor xnode in node.getElementsByTagName(\"host\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L56_C1", "label": "printinfo()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [8, 1, 0.4628, 0.0083, 1, 0.36, 0.0, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "\tlogger.printinfo(\"Parsing database-settings\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L57_C1", "label": "dom = parsedom()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [14, 1, 0.4711, 0.0083, 1, 0.36, 0.125, 401, 3, 1, 0, 0, 642, 10, 1], "semantic": {"name": "dom", "arg_names": [], "import_names": [], "rhs_call_name": "parsedom", "annotation": ""}, "snippet": "\tdom = parsedom(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L58_C1", "label": "dbsetting = DbSettings()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [14, 1, 0.4793, 0.0083, 1, 0.36, 0.25, 952, 3, 0, 0, 0, 562, 10, 1], "semantic": {"name": "dbsetting", "arg_names": [], "import_names": [], "rhs_call_name": "DbSettings", "annotation": ""}, "snippet": "\tdbsetting = DbSettings()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "label": "try", "type": "try", "loc": [60, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [7, 1, 0.5455, 0.1074, 1, 0.36, 0.375, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tfor node in dom.getElementsByTagName('database'):\n\t\t\tfor xnode in node.getElementsByTagName(\"host\"):\n\t\t\t\tdbsetting.host = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"username\"):\n\t\t\t\tdbsetting.username = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"password\"):\n\t\t\t\tdbsetting.password = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "label": "for node", "type": "for", "loc": [61, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "vector": [6, 2, 0.5372, 0.0744, 2, 0.99, 0.0, 772, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor node in dom.getElementsByTagName('database'):\n\t\t\tfor xnode in node.getElementsByTagName(\"host\"):\n\t\t\t\tdbsetting.host = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"username\"):\n\t\t\t\tdbsetting.username = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"password\"):\n\t\t\t\tdbsetting.password = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"schema\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L62_C3", "label": "for xnode", "type": "for", "loc": [62, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "vector": [6, 3, 0.5165, 0.0165, 3, 0.92, 0.0, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"host\"):\n\t\t\t\tdbsetting.host = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L63_C4", "label": "dbsetting.host =", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L62_C3", "vector": [14, 4, 0.5207, 0.0083, 4, 0.78, 0.0, 281, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbsetting.host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tdbsetting.host = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L64_C3", "label": "for xnode", "type": "for", "loc": [64, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "vector": [6, 3, 0.5331, 0.0165, 3, 0.92, 0.3333, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"username\"):\n\t\t\t\tdbsetting.username = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L65_C4", "label": "dbsetting.username =", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L64_C3", "vector": [14, 4, 0.5372, 0.0083, 4, 0.04, 0.0, 47, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbsetting.username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tdbsetting.username = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L66_C3", "label": "for xnode", "type": "for", "loc": [66, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "vector": [6, 3, 0.5496, 0.0165, 3, 0.92, 0.6667, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"password\"):\n\t\t\t\tdbsetting.password = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L67_C4", "label": "dbsetting.password =", "type": "assigned_variable", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L66_C3", "vector": [14, 4, 0.5537, 0.0083, 4, 0.44, 0.0, 540, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbsetting.password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tdbsetting.password = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L68_C3", "label": "for xnode", "type": "for", "loc": [68, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "vector": [6, 3, 0.5661, 0.0165, 3, 0.92, 1.0, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"schema\"):\n\t\t\t\tdbsetting.schema = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L69_C4", "label": "dbsetting.schema =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L68_C3", "vector": [14, 4, 0.5702, 0.0083, 4, 0.36, 0.0, 227, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbsetting.schema", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tdbsetting.schema = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L71_C4", "label": "printerror()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "vector": [8, 2, 0.5868, 0.0083, 2, 0.99, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Malformed xml elements\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L72_C4", "label": "exit()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "vector": [8, 2, 0.595, 0.0083, 2, 0.99, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1", "label": "if", "type": "if", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [4, 1, 0.6281, 0.0248, 1, 0.36, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif(dbsetting.host==\"\"):\n\t\t logger.printerror(\"Missing host\")\n\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L76_C4", "label": "printerror()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1", "vector": [8, 2, 0.6281, 0.0083, 2, 0.23, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Missing host\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L77_C4", "label": "exit()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1", "vector": [8, 2, 0.6364, 0.0083, 2, 0.23, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1", "label": "if", "type": "if", "loc": [79, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [4, 1, 0.6612, 0.0248, 1, 0.36, 0.625, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif(dbsetting.username==\"\"):\n\t\t logger.printerror(\"Missing username\")\n\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L80_C4", "label": "printerror()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1", "vector": [8, 2, 0.6612, 0.0083, 2, 0.88, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Missing username\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L81_C4", "label": "exit()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1", "vector": [8, 2, 0.6694, 0.0083, 2, 0.88, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [4, 1, 0.6942, 0.0248, 1, 0.36, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif(dbsetting.password==\"\"):\n\t\t logger.printerror(\"Missing password\")\n\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L84_C4", "label": "printerror()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1", "vector": [8, 2, 0.6942, 0.0083, 2, 0.96, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Missing password\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1", "vector": [8, 2, 0.7025, 0.0083, 2, 0.96, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1", "label": "if", "type": "if", "loc": [87, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [4, 1, 0.7273, 0.0248, 1, 0.36, 0.875, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif(dbsetting.schema==\"\"):\n\t\t logger.printerror(\"Missing schema\")\n\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L88_C4", "label": "printerror()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1", "vector": [8, 2, 0.7273, 0.0083, 2, 0.37, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Missing schema\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L89_C4", "label": "exit()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1", "vector": [8, 2, 0.7355, 0.0083, 2, 0.37, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L91_C1", "label": "return", "type": "return", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "vector": [13, 1, 0.7521, 0.0083, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn dbsetting;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "label": "Type", "type": "class", "loc": [94, 98], "level": 0, "parent": null, "vector": [3, 0, 0.7934, 0.0413, 0, 0.66, 0.875, 424, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Type:\n\tname=\"-noname-\"\n\tchangelog=\"\"\n\tregex=\"\"\n\tcheckout=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L95_C1", "label": "name =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "vector": [14, 1, 0.7851, 0.0083, 1, 0.51, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tname=\"-noname-\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L96_C1", "label": "changelog =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "vector": [14, 1, 0.7934, 0.0083, 1, 0.51, 0.3333, 282, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "changelog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tchangelog=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L97_C1", "label": "regex =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "vector": [14, 1, 0.8017, 0.0083, 1, 0.51, 0.6667, 552, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tregex=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L98_C1", "label": "checkout =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "vector": [14, 1, 0.8099, 0.0083, 1, 0.51, 1.0, 33, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "checkout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tcheckout=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "label": "gettypes", "type": "function", "loc": [100, 121], "level": 0, "parent": null, "vector": [2, 0, 0.9132, 0.1818, 0, 0.66, 1.0, 672, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "gettypes", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gettypes (file = 'settings/types.xml'):\n\ttypes = {};\n\tdom = parsedom(file)\n\tlogger.printinfo(\"Parsing supported vcs info\")\n\ttry:\n\t\tfor node in dom.getElementsByTagName('type'):\n\t\t\tproj = Type();\n\t\t\tfor xnode in node.getElementsByTagName(\"name\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L101_C1", "label": "types =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "vector": [14, 1, 0.8347, 0.0083, 1, 0.68, 0.0, 209, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttypes = {};"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L102_C1", "label": "dom = parsedom()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "vector": [14, 1, 0.843, 0.0083, 1, 0.68, 0.25, 401, 3, 1, 0, 0, 642, 10, 1], "semantic": {"name": "dom", "arg_names": [], "import_names": [], "rhs_call_name": "parsedom", "annotation": ""}, "snippet": "\tdom = parsedom(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L103_C1", "label": "printinfo()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "vector": [8, 1, 0.8512, 0.0083, 1, 0.68, 0.5, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "\tlogger.printinfo(\"Parsing supported vcs info\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "label": "try", "type": "try", "loc": [104, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "vector": [7, 1, 0.9215, 0.1322, 1, 0.68, 0.75, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tfor node in dom.getElementsByTagName('type'):\n\t\t\tproj = Type();\n\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"changelog\"):\n\t\t\t\tproj.changelog = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"regex\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "label": "for node", "type": "for", "loc": [105, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "vector": [6, 2, 0.9132, 0.0992, 2, 0.11, 0.0, 772, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor node in dom.getElementsByTagName('type'):\n\t\t\tproj = Type();\n\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"changelog\"):\n\t\t\t\tproj.changelog = xnode.firstChild.wholeText\n\t\t\tfor xnode in node.getElementsByTagName(\"regex\"):\n\t\t\t\tproj.regex = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L106_C3", "label": "proj = Type()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [14, 3, 0.876, 0.0083, 3, 0.84, 0.0, 88, 3, 0, 0, 0, 424, 10, 1], "semantic": {"name": "proj", "arg_names": [], "import_names": [], "rhs_call_name": "Type", "annotation": ""}, "snippet": "\t\t\tproj = Type();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L107_C3", "label": "for xnode", "type": "for", "loc": [107, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [6, 3, 0.8884, 0.0165, 3, 0.84, 0.2, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"name\"):\n\t\t\t\tproj.name = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L108_C4", "label": "proj.name =", "type": "assigned_variable", "loc": [108, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L107_C3", "vector": [14, 4, 0.8926, 0.0083, 4, 0.35, 0.0, 666, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.name = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L109_C3", "label": "for xnode", "type": "for", "loc": [109, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [6, 3, 0.905, 0.0165, 3, 0.84, 0.4, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"changelog\"):\n\t\t\t\tproj.changelog = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L110_C4", "label": "proj.changelog =", "type": "assigned_variable", "loc": [110, 110], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L109_C3", "vector": [14, 4, 0.9091, 0.0083, 4, 0.74, 0.0, 700, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.changelog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.changelog = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L111_C3", "label": "for xnode", "type": "for", "loc": [111, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [6, 3, 0.9215, 0.0165, 3, 0.84, 0.6, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"regex\"):\n\t\t\t\tproj.regex = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L112_C4", "label": "proj.regex =", "type": "assigned_variable", "loc": [112, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L111_C3", "vector": [14, 4, 0.9256, 0.0083, 4, 0.82, 0.0, 822, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.regex = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:For_L113_C3", "label": "for xnode", "type": "for", "loc": [113, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [6, 3, 0.938, 0.0165, 3, 0.84, 0.8, 41, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "xnode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfor xnode in node.getElementsByTagName(\"checkout\"):\n\t\t\t\tproj.checkout = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L114_C4", "label": "proj.checkout =", "type": "assigned_variable", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L113_C3", "vector": [14, 4, 0.9421, 0.0083, 4, 0.8, 0.0, 940, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "proj.checkout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tproj.checkout = xnode.firstChild.wholeText"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L116_C3", "label": "assign", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "vector": [14, 3, 0.9587, 0.0083, 3, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttypes[proj.name]=proj;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L118_C4", "label": "printerror()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "vector": [8, 2, 0.9752, 0.0083, 2, 0.11, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\t logger.printerror(\"Malformed xml elements\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L119_C4", "label": "exit()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "vector": [8, 2, 0.9835, 0.0083, 2, 0.11, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L121_C1", "label": "return", "type": "return", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "vector": [13, 1, 1.0, 0.0083, 1, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn types;"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L14_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L15_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L21_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L27_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L28_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L31_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L33_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L33_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L35_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L35_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L37_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L37_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L40_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L41_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L50_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L51_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L52_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L53_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L57_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L58_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L62_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L62_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L64_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L66_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L66_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L68_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L68_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L60_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L75_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L79_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L83_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:If_L87_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L91_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L95_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L96_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L97_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:ClassDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L98_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L101_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L102_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L103_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L107_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L107_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L109_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L109_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L111_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L111_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:For_L113_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L113_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:For_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Assign_L116_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:Try_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_772:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_772:Return_L121_C1"}] |
##
## mercurial-analyzer
##
## Requires: Cloc (sudo apt-get install cloc)
import analyzelib
import settingsreader
from database import DbHandler
import logger
def getType(types, name):
try:
ret = types[name];
return ret
except Exception:
logger.printerror("Missing type "+name)
exit();
logger.printinfo("\t------------------------")
logger.printinfo("\t 0x90-analyzer ")
logger.printinfo("\t------------------------")
# Connect to mysql-db with settings from settings.xml
dbsettings = settingsreader.getdbsettings()
db = DbHandler(dbsettings)
types = settingsreader.gettypes()
# Find and analyze projects from settings.xml
projects = settingsreader.getprojects()
for project in projects:
type = getType(types, project.type);
analyzelib.analyze_project(project, type, db)
logger.printinfo("Done.")
| ajibawa-2023/Python-Code-Large/train/row_774 | 21 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_774:Import_L6_C0", "label": "analyzelib import analyzelib", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0278, 0, 0.66, 0.0, 443, 0, 1, 0, 0, 443, 0, 0], "semantic": {"name": "analyzelib", "arg_names": [], "import_names": ["analyzelib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import analyzelib "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Import_L7_C0", "label": "settingsreader import settingsreader", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1944, 0.0278, 0, 0.66, 0.0769, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "settingsreader", "arg_names": [], "import_names": ["settingsreader"], "rhs_call_name": "", "annotation": ""}, "snippet": "import settingsreader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:ImportFrom_L8_C0", "label": "from database import DbHandler", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0278, 0, 0.66, 0.1538, 329, 0, 1, 0, 0, 329, 0, 0], "semantic": {"name": "database", "arg_names": [], "import_names": ["DbHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": "from database import DbHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Import_L9_C0", "label": "logger import logger", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0278, 0, 0.66, 0.2308, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "logger", "arg_names": [], "import_names": ["logger"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:FunctionDef_L11_C0", "label": "getType", "type": "function", "loc": [11, 17], "level": 0, "parent": null, "vector": [2, 0, 0.3889, 0.1944, 0, 0.66, 0.3077, 710, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "getType", "arg_names": ["types", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getType(types, name):\n\ttry:\n\t\tret = types[name];\n\t\treturn ret\n\texcept Exception:\n\t\tlogger.printerror(\"Missing type \"+name)\n\t\texit();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "label": "try", "type": "try", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:FunctionDef_L11_C0", "vector": [7, 1, 0.4028, 0.1667, 1, 0.0, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\tret = types[name];\n\t\treturn ret\n\texcept Exception:\n\t\tlogger.printerror(\"Missing type \"+name)\n\t\texit();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L13_C2", "label": "ret =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "vector": [14, 2, 0.3611, 0.0278, 2, 0.75, 0.0, 501, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tret = types[name];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Return_L14_C2", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "vector": [13, 2, 0.3889, 0.0278, 2, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L16_C2", "label": "printerror()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "vector": [8, 2, 0.4444, 0.0278, 2, 0.75, 0.0, 562, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printerror", "arg_names": [], "import_names": [], "rhs_call_name": "printerror", "annotation": ""}, "snippet": "\t\tlogger.printerror(\"Missing type \"+name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L17_C2", "label": "exit()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "vector": [8, 2, 0.4722, 0.0278, 2, 0.75, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\texit();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L19_C0", "label": "printinfo()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.5278, 0.0278, 0, 0.66, 0.3846, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "logger.printinfo(\"\\t------------------------\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L20_C0", "label": "printinfo()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 0.5556, 0.0278, 0, 0.66, 0.4615, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "logger.printinfo(\"\\t 0x90-analyzer\t \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L21_C0", "label": "printinfo()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.5833, 0.0278, 0, 0.66, 0.5385, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "logger.printinfo(\"\\t------------------------\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L24_C0", "label": "dbsettings = getdbsettings()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0278, 0, 0.66, 0.6154, 181, 3, 0, 0, 0, 783, 10, 1], "semantic": {"name": "dbsettings", "arg_names": [], "import_names": [], "rhs_call_name": "getdbsettings", "annotation": ""}, "snippet": "dbsettings = settingsreader.getdbsettings()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L26_C0", "label": "db = DbHandler()", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.7222, 0.0278, 0, 0.66, 0.6923, 761, 3, 1, 0, 0, 737, 10, 1], "semantic": {"name": "db", "arg_names": [], "import_names": [], "rhs_call_name": "DbHandler", "annotation": ""}, "snippet": "db = DbHandler(dbsettings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L28_C0", "label": "types = gettypes()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.7778, 0.0278, 0, 0.66, 0.7692, 209, 3, 0, 0, 0, 672, 10, 1], "semantic": {"name": "types", "arg_names": [], "import_names": [], "rhs_call_name": "gettypes", "annotation": ""}, "snippet": "types = settingsreader.gettypes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L31_C0", "label": "projects = getprojects()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.8611, 0.0278, 0, 0.66, 0.8462, 324, 3, 0, 0, 0, 620, 10, 1], "semantic": {"name": "projects", "arg_names": [], "import_names": [], "rhs_call_name": "getprojects", "annotation": ""}, "snippet": "projects = settingsreader.getprojects()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:For_L32_C0", "label": "for project", "type": "for", "loc": [32, 34], "level": 0, "parent": null, "vector": [6, 0, 0.9167, 0.0833, 0, 0.66, 0.9231, 841, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "project", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for project in projects:\n\ttype = getType(types, project.type);\n\tanalyzelib.analyze_project(project, type, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L33_C1", "label": "type = getType()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:For_L32_C0", "vector": [14, 1, 0.9167, 0.0278, 1, 0.22, 0.0, 801, 3, 2, 0, 0, 710, 10, 1], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "getType", "annotation": ""}, "snippet": "\ttype = getType(types, project.type);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L34_C1", "label": "analyze_project()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_774:For_L32_C0", "vector": [8, 1, 0.9444, 0.0278, 1, 0.22, 1.0, 292, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "analyze_project", "arg_names": [], "import_names": [], "rhs_call_name": "analyze_project", "annotation": ""}, "snippet": "\tanalyzelib.analyze_project(project, type, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L36_C0", "label": "printinfo()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0278, 0, 0.66, 1.0, 989, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printinfo", "arg_names": [], "import_names": [], "rhs_call_name": "printinfo", "annotation": ""}, "snippet": "logger.printinfo(\"Done.\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_774:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Return_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:Try_L12_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:For_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Assign_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_774:For_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_774:Expr_L34_C1"}] |
#====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation. For more
# information on the Apache Software Foundation, please see
# <http://www.apache.org/>.
#
import os
import re
import tempfile
import shutil
ignore_pattern = re.compile('^(.svn|target|bin|classes)')
java_pattern = re.compile('^.*\.java')
annot_pattern = re.compile('import org\.apache\.http\.annotation\.')
def process_dir(dir):
files = os.listdir(dir)
for file in files:
f = os.path.join(dir, file)
if os.path.isdir(f):
if not ignore_pattern.match(file):
process_dir(f)
else:
if java_pattern.match(file):
process_source(f)
def process_source(filename):
tmp = tempfile.mkstemp()
tmpfd = tmp[0]
tmpfile = tmp[1]
try:
changed = False
dst = os.fdopen(tmpfd, 'w')
try:
src = open(filename)
try:
for line in src:
if annot_pattern.match(line):
changed = True
line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')
dst.write(line)
finally:
src.close()
finally:
dst.close();
if changed:
shutil.move(tmpfile, filename)
else:
os.remove(tmpfile)
except:
os.remove(tmpfile)
process_dir('.')
| ajibawa-2023/Python-Code-Large/train/row_775 | 38 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_775:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3514, 0.0135, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Import_L27_C0", "label": "re import re", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3649, 0.0135, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Import_L28_C0", "label": "tempfile import tempfile", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.3784, 0.0135, 0, 0.66, 0.2222, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "tempfile", "arg_names": [], "import_names": ["tempfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tempfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Import_L29_C0", "label": "shutil import shutil", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.3919, 0.0135, 0, 0.66, 0.3333, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L31_C0", "label": "ignore_pattern = compile()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4189, 0.0135, 0, 0.66, 0.4444, 989, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ignore_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ignore_pattern = re.compile('^(.svn|target|bin|classes)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L32_C0", "label": "java_pattern = compile()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4324, 0.0135, 0, 0.66, 0.5556, 579, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "java_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "java_pattern = re.compile('^.*\\.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L33_C0", "label": "annot_pattern = compile()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4459, 0.0135, 0, 0.66, 0.6667, 164, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "annot_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "label": "process_dir", "type": "function", "loc": [35, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5338, 0.1351, 0, 0.66, 0.7778, 660, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "process_dir", "arg_names": ["dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_dir(dir):\n files = os.listdir(dir)\n for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L36_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.75, 0.0, 598, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files = os.listdir(dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4", "label": "for file", "type": "for", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "vector": [6, 1, 0.5473, 0.1081, 1, 0.75, 1.0, 107, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L38_C8", "label": "f = join()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4", "vector": [14, 2, 0.5135, 0.0135, 2, 0.3, 0.0, 899, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " f = os.path.join(dir, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4", "vector": [4, 2, 0.5608, 0.0811, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8", "vector": [4, 3, 0.5473, 0.027, 3, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ignore_pattern.match(file):\n process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L41_C16", "label": "process_dir()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L40_C12", "vector": [8, 4, 0.5541, 0.0135, 4, 0.82, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": " process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:If_L43_C12", "label": "if", "type": "if", "loc": [43, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8", "vector": [4, 3, 0.5878, 0.027, 3, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L44_C16", "label": "process_source()", "type": "expression", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L43_C12", "vector": [8, 4, 0.5946, 0.0135, 4, 0.57, 0.0, 173, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_source", "arg_names": [], "import_names": [], "rhs_call_name": "process_source", "annotation": ""}, "snippet": " process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "label": "process_source", "type": "function", "loc": [46, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7973, 0.3649, 0, 0.66, 0.8889, 173, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "process_source", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_source(filename):\n tmp = tempfile.mkstemp()\n tmpfd = tmp[0]\n tmpfile = tmp[1]\n try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L47_C4", "label": "tmp = mkstemp()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "vector": [14, 1, 0.6351, 0.0135, 1, 0.01, 0.0, 517, 3, 0, 0, 0, 708, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "mkstemp", "annotation": ""}, "snippet": " tmp = tempfile.mkstemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L48_C4", "label": "tmpfd =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "vector": [14, 1, 0.6486, 0.0135, 1, 0.01, 0.3333, 608, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfd = tmp[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L49_C4", "label": "tmpfile =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "vector": [14, 1, 0.6622, 0.0135, 1, 0.01, 0.6667, 719, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfile = tmp[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "label": "try", "type": "try", "loc": [50, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "vector": [7, 1, 0.8243, 0.3108, 1, 0.01, 1.0, 0, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L51_C8", "label": "changed =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "vector": [14, 2, 0.6892, 0.0135, 2, 0.26, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L52_C8", "label": "dst = fdopen()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "vector": [14, 2, 0.7027, 0.0135, 2, 0.26, 0.3333, 856, 3, 2, 0, 0, 783, 10, 1], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "fdopen", "annotation": ""}, "snippet": " dst = os.fdopen(tmpfd, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "vector": [7, 2, 0.7905, 0.1622, 2, 0.26, 0.6667, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L54_C12", "label": "src = open()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "vector": [14, 3, 0.7297, 0.0135, 3, 0.59, 0.0, 345, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " src = open(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12", "label": "try", "type": "try", "loc": [55, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "vector": [7, 3, 0.7905, 0.1081, 3, 0.59, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)\n finally:\n src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16", "label": "for line", "type": "for", "loc": [56, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12", "vector": [6, 4, 0.7838, 0.0676, 4, 0.56, 0.0, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20", "label": "if", "type": "if", "loc": [57, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16", "vector": [4, 5, 0.7838, 0.0405, 5, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L58_C24", "label": "changed =", "type": "assigned_variable", "loc": [58, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20", "vector": [14, 6, 0.7838, 0.0135, 6, 0.18, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L59_C24", "label": "line = replace()", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20", "vector": [14, 6, 0.7973, 0.0135, 6, 0.18, 1.0, 373, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L60_C20", "label": "write()", "type": "expression", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16", "vector": [8, 5, 0.8108, 0.0135, 5, 0.61, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L62_C15", "label": "close()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12", "vector": [8, 4, 0.8378, 0.0135, 4, 0.56, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L64_C12", "label": "close()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "vector": [8, 3, 0.8649, 0.0135, 3, 0.59, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " dst.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8", "label": "if", "type": "if", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "vector": [4, 2, 0.9122, 0.0541, 2, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if changed:\n shutil.move(tmpfile, filename)\n else:\n os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L67_C12", "label": "move()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8", "vector": [8, 3, 0.9054, 0.0135, 3, 0.73, 0.0, 856, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "move", "annotation": ""}, "snippet": " shutil.move(tmpfile, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L69_C12", "label": "remove()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8", "vector": [8, 3, 0.9324, 0.0135, 3, 0.73, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L72_C8", "label": "remove()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "vector": [8, 2, 0.973, 0.0135, 2, 0.26, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L74_C0", "label": "process_dir()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0135, 0, 0.66, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": "process_dir('.')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L58_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Assign_L59_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L62_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_775:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_775:Expr_L72_C8"}] |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
# uploading files to Google Code projects.
#
# To upload a file to Google Code, you need to provide a path to the
# file on your local machine, a small summary of what the file is, a
# project name, and a valid account that is a member or owner of that
# project. You can optionally provide a list of labels that apply to
# the file. The file will be uploaded under the same name that it has
# in your local filesystem (that is, the "basename" or last path
# component). Run the script with '--help' to get the exact syntax
# and available options.
#
# Note that the upload script requests that you enter your
# googlecode.com password. This is NOT your Gmail account password!
# This is the password you use on googlecode.com for committing to
# Subversion and uploading files. You can find your password by going
# to http://code.google.com/hosting/settings when logged in with your
# Gmail account. If you have already committed to your project's
# Subversion repository, the script will automatically retrieve your
# credentials from there (unless disabled, see the output of '--help'
# for details).
#
# If you are looking at this script as a reference for implementing
# your own Google Code file uploader, then you should take a look at
# the upload() function, which is the meat of the uploader. You
# basically need to build a multipart/form-data POST request with the
# right fields and send it to https://PROJECT.googlecode.com/files .
# Authenticate the request using HTTP Basic authentication, as is
# shown below.
#
# Licensed under the terms of the Apache Software License 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
#
# Questions, comments, feature requests and patches are most welcome.
# Please direct all of these to the Google Code users group:
# http://groups.google.com/group/google-code-hosting
"""Google Code file uploader script.
"""
__author__ = 'danderson@google.com (David Anderson)'
import httplib
import os.path
import optparse
import getpass
import base64
import sys
def upload(file, project_name, user_name, password, summary, labels=None):
"""Upload a file to a Google Code project's file server.
Args:
file: The local path to the file.
project_name: The name of your project on Google Code.
user_name: Your Google account name.
password: The googlecode.com password for your account.
Note that this is NOT your global Google Account password!
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
Returns: a tuple:
http_status: 201 if the upload succeeded, something else if an
error occured.
http_reason: The human-readable string associated with http_status
file_url: If the upload succeeded, the URL of the file on Google
Code, None otherwise.
"""
# The login is the user part of user@gmail.com. If the login provided
# is in the full user@domain form, strip it down.
if user_name.endswith('@gmail.com'):
user_name = user_name[:user_name.index('@gmail.com')]
form_fields = [('summary', summary)]
if labels is not None:
form_fields.extend([('label', l.strip()) for l in labels])
content_type, body = encode_upload_request(form_fields, file)
upload_host = '%s.googlecode.com' % project_name
upload_uri = '/files'
auth_token = base64.b64encode('%s:%s'% (user_name, password))
headers = {
'Authorization': 'Basic %s' % auth_token,
'User-Agent': 'Googlecode.com uploader v0.9.4',
'Content-Type': content_type,
}
server = httplib.HTTPSConnection(upload_host)
server.request('POST', upload_uri, body, headers)
resp = server.getresponse()
server.close()
if resp.status == 201:
location = resp.getheader('Location', None)
else:
location = None
return resp.status, resp.reason, location
def encode_upload_request(fields, file_path):
"""Encode the given fields and file into a multipart form body.
fields is a sequence of (name, value) pairs. file is the path of
the file to upload. The file will be uploaded to Google Code with
the same file name.
Returns: (content_type, body) ready for httplib.HTTP instance
"""
BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
CRLF = '\r\n'
body = []
# Add the metadata about the upload first
for key, value in fields:
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="%s"' % key,
'',
value,
])
# Now add the file itself
file_name = os.path.basename(file_path)
f = open(file_path, 'rb')
file_content = f.read()
f.close()
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="filename"; filename="%s"'
% file_name,
# The upload server determines the mime-type, no need to set it.
'Content-Type: application/octet-stream',
'',
file_content,
])
# Finalize the form body
body.extend(['--' + BOUNDARY + '--', ''])
return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
def upload_find_auth(file_path, project_name, summary, labels=None,
user_name=None, password=None, tries=3):
"""Find credentials and upload a file to a Google Code project's file server.
file_path, project_name, summary, and labels are passed as-is to upload.
Args:
file_path: The local path to the file.
project_name: The name of your project on Google Code.
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
config_dir: Path to Subversion configuration directory, 'none', or None.
user_name: Your Google account name.
tries: How many attempts to make.
"""
while tries > 0:
if user_name is None:
# Read username if not specified or loaded from svn config, or on
# subsequent tries.
sys.stdout.write('Please enter your googlecode.com username: ')
sys.stdout.flush()
user_name = sys.stdin.readline().rstrip()
if password is None:
# Read password if not loaded from svn config, or on subsequent tries.
print 'Please enter your googlecode.com password.'
print '** Note that this is NOT your Gmail account password! **'
print 'It is the password you use to access Subversion repositories,'
print 'and can be found here: http://code.google.com/hosting/settings'
password = getpass.getpass()
status, reason, url = upload(file_path, project_name, user_name, password,
summary, labels)
# Returns 403 Forbidden instead of 401 Unauthorized for bad
# credentials as of 2007-07-17.
if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
# Rest for another try.
user_name = password = None
tries = tries - 1
else:
# We're done.
break
return status, reason, url
def main():
parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
'-p PROJECT [options] FILE')
parser.add_option('-s', '--summary', dest='summary',
help='Short description of the file')
parser.add_option('-p', '--project', dest='project',
help='Google Code project name')
parser.add_option('-u', '--user', dest='user',
help='Your Google Code username')
parser.add_option('-w', '--password', dest='password',
help='Your Google Code password')
parser.add_option('-l', '--labels', dest='labels',
help='An optional list of comma-separated labels to attach '
'to the file')
options, args = parser.parse_args()
if not options.summary:
parser.error('File summary is missing.')
elif not options.project:
parser.error('Project name is missing.')
elif len(args) < 1:
parser.error('File to upload not provided.')
elif len(args) > 1:
parser.error('Only one file may be specified.')
file_path = args[0]
if options.labels:
labels = options.labels.split(',')
else:
labels = None
status, reason, url = upload_find_auth(file_path, options.project,
options.summary, labels,
options.user, options.password)
if url:
print 'The file was uploaded successfully.'
print 'URL: %s' % url
return 0
else:
print 'An error occurred. Your file was not uploaded.'
print 'Google Code upload server said: %s (%s)' % (reason, status)
return 1
if __name__ == '__main__':
sys.exit(main())
| ajibawa-2023/Python-Code-Large/train/row_777 | 90 | 248 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L46_C0", "label": "expression", "type": "expression", "loc": [46, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1875, 0.0081, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Google Code file uploader script.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L49_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.1976, 0.004, 0, 0.66, 0.0833, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'danderson@google.com (David Anderson)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L51_C0", "label": "httplib import httplib", "type": "import", "loc": [51, 51], "level": 0, "parent": null, "vector": [1, 0, 0.2056, 0.004, 0, 0.66, 0.1667, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L52_C0", "label": "os.path import os.path", "type": "import", "loc": [52, 52], "level": 0, "parent": null, "vector": [1, 0, 0.2097, 0.004, 0, 0.66, 0.25, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["os.path"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L53_C0", "label": "optparse import optparse", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.2137, 0.004, 0, 0.66, 0.3333, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L54_C0", "label": "getpass import getpass", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 0.2177, 0.004, 0, 0.66, 0.4167, 784, 0, 1, 0, 0, 784, 0, 0], "semantic": {"name": "getpass", "arg_names": [], "import_names": ["getpass"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L55_C0", "label": "base64 import base64", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.2218, 0.004, 0, 0.66, 0.5, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Import_L56_C0", "label": "sys import sys", "type": "import", "loc": [56, 56], "level": 0, "parent": null, "vector": [1, 0, 0.2258, 0.004, 0, 0.66, 0.5833, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "label": "upload", "type": "function", "loc": [59, 107], "level": 0, "parent": null, "vector": [2, 0, 0.3347, 0.1976, 0, 0.66, 0.6667, 920, 0, 6, 1, 0, 0, 0, 11], "semantic": {"name": "upload", "arg_names": ["file", "project_name", "user_name", "password", "summary", "labels"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload(file, project_name, user_name, password, summary, labels=None):\n \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [8, 1, 0.2762, 0.0726, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account.\n Note that this is NOT your global Google Account password!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L80_C2", "label": "if", "type": "if", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [4, 1, 0.3246, 0.0081, 1, 0.45, 0.0714, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name.endswith('@gmail.com'):\n user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L81_C4", "label": "user_name =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L80_C2", "vector": [14, 2, 0.3266, 0.004, 2, 0.13, 0.0, 3, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L83_C2", "label": "form_fields =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3347, 0.004, 1, 0.45, 0.1429, 486, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "form_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form_fields = [('summary', summary)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L84_C2", "label": "if", "type": "if", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [4, 1, 0.3407, 0.0081, 1, 0.45, 0.2143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if labels is not None:\n form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L85_C4", "label": "extend()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L84_C2", "vector": [8, 2, 0.3427, 0.004, 2, 0.95, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L87_C2", "label": "content_type, body = encode_upload_request()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3508, 0.004, 1, 0.45, 0.2857, 433, 3, 2, 0, 0, 133, 10, 1], "semantic": {"name": "content_type, body", "arg_names": [], "import_names": [], "rhs_call_name": "encode_upload_request", "annotation": ""}, "snippet": " content_type, body = encode_upload_request(form_fields, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L89_C2", "label": "upload_host =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3589, 0.004, 1, 0.45, 0.3571, 380, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upload_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_host = '%s.googlecode.com' % project_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L90_C2", "label": "upload_uri =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3629, 0.004, 1, 0.45, 0.4286, 669, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "upload_uri", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_uri = '/files'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L91_C2", "label": "auth_token = b64encode()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3669, 0.004, 1, 0.45, 0.5, 958, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "auth_token", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " auth_token = base64.b64encode('%s:%s'% (user_name, password))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L92_C2", "label": "headers =", "type": "assigned_variable", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.379, 0.0202, 1, 0.45, 0.5714, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'Authorization': 'Basic %s' % auth_token,\n 'User-Agent': 'Googlecode.com uploader v0.9.4',\n 'Content-Type': content_type,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L98_C2", "label": "server = HTTPSConnection()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.3952, 0.004, 1, 0.45, 0.6429, 268, 3, 1, 0, 0, 40, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPSConnection", "annotation": ""}, "snippet": " server = httplib.HTTPSConnection(upload_host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L99_C2", "label": "request()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [8, 1, 0.3992, 0.004, 1, 0.45, 0.7143, 50, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " server.request('POST', upload_uri, body, headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L100_C2", "label": "resp = getresponse()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [14, 1, 0.4032, 0.004, 1, 0.45, 0.7857, 48, 3, 0, 0, 0, 47, 10, 1], "semantic": {"name": "resp", "arg_names": [], "import_names": [], "rhs_call_name": "getresponse", "annotation": ""}, "snippet": " resp = server.getresponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L101_C2", "label": "close()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [8, 1, 0.4073, 0.004, 1, 0.45, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " server.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2", "label": "if", "type": "if", "loc": [103, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [4, 1, 0.4214, 0.0161, 1, 0.45, 0.9286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp.status == 201:\n location = resp.getheader('Location', None)\n else:\n location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L104_C4", "label": "location = getheader()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2", "vector": [14, 2, 0.4194, 0.004, 2, 0.0, 0.0, 771, 3, 2, 0, 0, 644, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "getheader", "annotation": ""}, "snippet": " location = resp.getheader('Location', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L106_C4", "label": "location =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2", "vector": [14, 2, 0.4274, 0.004, 2, 0.0, 1.0, 771, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L107_C2", "label": "return", "type": "return", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "vector": [13, 1, 0.4315, 0.004, 1, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resp.status, resp.reason, location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "label": "encode_upload_request", "type": "function", "loc": [110, 152], "level": 0, "parent": null, "vector": [2, 0, 0.5282, 0.1734, 0, 0.66, 0.75, 133, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "encode_upload_request", "arg_names": ["fields", "file_path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_upload_request(fields, file_path):\n \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L111_C2", "label": "expression", "type": "expression", "loc": [111, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [8, 1, 0.4617, 0.0323, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L119_C2", "label": "BOUNDARY =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.4798, 0.004, 1, 0.13, 0.0909, 677, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDARY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L120_C2", "label": "CRLF =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.4839, 0.004, 1, 0.13, 0.1818, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CRLF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CRLF = '\\r\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L122_C2", "label": "body =", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.4919, 0.004, 1, 0.13, 0.2727, 477, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:For_L125_C2", "label": "for key, value", "type": "for", "loc": [125, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [6, 1, 0.5161, 0.0282, 1, 0.13, 0.3636, 839, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in fields:\n body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L126_C4", "label": "extend()", "type": "expression", "loc": [126, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:For_L125_C2", "vector": [8, 2, 0.5181, 0.0242, 2, 0.44, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L134_C2", "label": "file_name = basename()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.5403, 0.004, 1, 0.13, 0.4545, 991, 3, 1, 0, 0, 164, 10, 1], "semantic": {"name": "file_name", "arg_names": [], "import_names": [], "rhs_call_name": "basename", "annotation": ""}, "snippet": " file_name = os.path.basename(file_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L135_C2", "label": "f = open()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.5444, 0.004, 1, 0.13, 0.5455, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(file_path, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L136_C2", "label": "file_content = read()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [14, 1, 0.5484, 0.004, 1, 0.13, 0.6364, 412, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "file_content", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " file_content = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L137_C2", "label": "close()", "type": "expression", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [8, 1, 0.5524, 0.004, 1, 0.13, 0.7273, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L139_C2", "label": "extend()", "type": "expression", "loc": [139, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [8, 1, 0.5766, 0.0363, 1, 0.13, 0.8182, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"filename\"; filename=\"%s\"'\n % file_name,\n # The upload server determines the mime-type, no need to set it.\n 'Content-Type: application/octet-stream',\n '',\n file_content,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L150_C2", "label": "extend()", "type": "expression", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [8, 1, 0.6048, 0.004, 1, 0.13, 0.9091, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(['--' + BOUNDARY + '--', ''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L152_C2", "label": "return", "type": "return", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "vector": [13, 1, 0.6129, 0.004, 1, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "label": "upload_find_auth", "type": "function", "loc": [155, 198], "level": 0, "parent": null, "vector": [2, 0, 0.7117, 0.1774, 0, 0.66, 0.8333, 28, 0, 7, 1, 0, 0, 0, 10], "semantic": {"name": "upload_find_auth", "arg_names": ["file_path", "project_name", "summary", "labels", "user_name", "password", "tries"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload_find_auth(file_path, project_name, summary, labels=None,\n user_name=None, password=None, tries=3):\n \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L157_C2", "label": "expression", "type": "expression", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "vector": [8, 1, 0.6573, 0.0524, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file.\n project_name: The name of your project on Google Code.\n summary: A small description for the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "label": "while", "type": "while", "loc": [171, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "vector": [5, 1, 0.7399, 0.1048, 1, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while tries > 0:\n if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()\n if password is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "label": "if", "type": "if", "loc": [172, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "vector": [4, 2, 0.7036, 0.0242, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L175_C6", "label": "write()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "vector": [8, 3, 0.7056, 0.004, 3, 0.69, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write('Please enter your googlecode.com username: ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L176_C6", "label": "flush()", "type": "expression", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "vector": [8, 3, 0.7097, 0.004, 3, 0.69, 0.5, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " sys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L177_C6", "label": "user_name = rstrip()", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "vector": [14, 3, 0.7137, 0.004, 3, 0.69, 1.0, 3, 3, 0, 0, 0, 807, 10, 2], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "rstrip", "annotation": ""}, "snippet": " user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "label": "if", "type": "if", "loc": [178, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "vector": [4, 2, 0.7298, 0.0282, 2, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if password is None:\n # Read password if not loaded from svn config, or on subsequent tries.\n print('Please enter your googlecode.com password.')\n print('** Note that this is NOT your Gmail account password! **')\n print('It is the password you use to access Subversion repositories,')\n print('and can be found here: http://code.google.com/hosting/settings')\n password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L180_C6", "label": "print()", "type": "expression", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "vector": [8, 3, 0.7258, 0.004, 3, 0.27, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please enter your googlecode.com password.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L181_C6", "label": "print()", "type": "expression", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "vector": [8, 3, 0.7298, 0.004, 3, 0.27, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('** Note that this is NOT your Gmail account password! **')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L182_C6", "label": "print()", "type": "expression", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "vector": [8, 3, 0.7339, 0.004, 3, 0.27, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('It is the password you use to access Subversion repositories,')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L183_C6", "label": "print()", "type": "expression", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "vector": [8, 3, 0.7379, 0.004, 3, 0.27, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('and can be found here: http://code.google.com/hosting/settings')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L184_C6", "label": "password = getpass()", "type": "assigned_variable", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "vector": [14, 3, 0.7419, 0.004, 3, 0.27, 1.0, 489, 3, 0, 0, 0, 784, 10, 1], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "getpass", "annotation": ""}, "snippet": " password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L186_C4", "label": "status, reason, url = upload()", "type": "assigned_variable", "loc": [186, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "vector": [14, 2, 0.752, 0.0081, 2, 0.62, 0.6667, 92, 3, 6, 0, 0, 920, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload", "annotation": ""}, "snippet": " status, reason, url = upload(file_path, project_name, user_name, password,\n summary, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4", "label": "if", "type": "if", "loc": [190, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "vector": [4, 2, 0.7782, 0.0282, 2, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:\n # Rest for another try.\n user_name = password = None\n tries = tries - 1\n else:\n # We're done.\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L192_C6", "label": "user_name =", "type": "assigned_variable", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4", "vector": [14, 3, 0.7742, 0.004, 3, 0.05, 0.0, 3, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = password = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L193_C6", "label": "tries =", "type": "assigned_variable", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4", "vector": [14, 3, 0.7782, 0.004, 3, 0.05, 1.0, 915, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tries = tries - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L198_C2", "label": "return", "type": "return", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "vector": [13, 1, 0.7984, 0.004, 1, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status, reason, url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "label": "main", "type": "function", "loc": [201, 244], "level": 0, "parent": null, "vector": [2, 0, 0.8972, 0.1774, 0, 0.66, 0.9167, 624, 0, 0, 1, 0, 0, 0, 19], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')\n parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')\n parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')\n parser.add_option('-u', '--user', dest='user',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L202_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [202, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [14, 1, 0.8165, 0.0081, 1, 0.25, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L204_C2", "label": "add_option()", "type": "expression", "loc": [204, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [8, 1, 0.8246, 0.0081, 1, 0.25, 0.0909, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L206_C2", "label": "add_option()", "type": "expression", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [8, 1, 0.8327, 0.0081, 1, 0.25, 0.1818, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L208_C2", "label": "add_option()", "type": "expression", "loc": [208, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [8, 1, 0.8407, 0.0081, 1, 0.25, 0.2727, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-u', '--user', dest='user',\n help='Your Google Code username')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L210_C2", "label": "add_option()", "type": "expression", "loc": [210, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [8, 1, 0.8488, 0.0081, 1, 0.25, 0.3636, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-w', '--password', dest='password',\n help='Your Google Code password')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L212_C2", "label": "add_option()", "type": "expression", "loc": [212, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [8, 1, 0.8589, 0.0121, 1, 0.25, 0.4545, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-l', '--labels', dest='labels',\n help='An optional list of comma-separated labels to attach '\n 'to the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L216_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [14, 1, 0.871, 0.004, 1, 0.25, 0.5455, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " options, args = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2", "label": "if", "type": "if", "loc": [218, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [4, 1, 0.8931, 0.0323, 1, 0.25, 0.6364, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not options.summary:\n parser.error('File summary is missing.')\n elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L219_C4", "label": "error()", "type": "expression", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2", "vector": [8, 2, 0.8831, 0.004, 2, 0.25, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File summary is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2", "label": "if", "type": "if", "loc": [220, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2", "vector": [4, 2, 0.8972, 0.0242, 2, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L221_C4", "label": "error()", "type": "expression", "loc": [221, 221], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2", "vector": [8, 3, 0.8911, 0.004, 3, 0.52, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Project name is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2", "label": "if", "type": "if", "loc": [222, 225], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2", "vector": [4, 3, 0.9012, 0.0161, 3, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L223_C4", "label": "error()", "type": "expression", "loc": [223, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2", "vector": [8, 4, 0.8992, 0.004, 4, 0.96, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File to upload not provided.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L224_C2", "label": "if", "type": "if", "loc": [224, 225], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2", "vector": [4, 4, 0.9052, 0.0081, 4, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L225_C4", "label": "error()", "type": "expression", "loc": [225, 225], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L224_C2", "vector": [8, 5, 0.9073, 0.004, 5, 0.99, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L227_C2", "label": "file_path =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [14, 1, 0.9153, 0.004, 1, 0.25, 0.7273, 397, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_path = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2", "label": "if", "type": "if", "loc": [229, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [4, 1, 0.9294, 0.0161, 1, 0.25, 0.8182, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.labels:\n labels = options.labels.split(',')\n else:\n labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L230_C4", "label": "labels = split()", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2", "vector": [14, 2, 0.9274, 0.004, 2, 0.49, 0.0, 283, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " labels = options.labels.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L232_C4", "label": "labels =", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2", "vector": [14, 2, 0.9355, 0.004, 2, 0.49, 1.0, 283, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L234_C2", "label": "status, reason, url = upload_find_auth()", "type": "assigned_variable", "loc": [234, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [14, 1, 0.9476, 0.0121, 1, 0.25, 0.9091, 92, 3, 6, 0, 0, 28, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload_find_auth", "annotation": ""}, "snippet": " status, reason, url = upload_find_auth(file_path, options.project,\n options.summary, labels,\n options.user, options.password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "label": "if", "type": "if", "loc": [237, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "vector": [4, 1, 0.9698, 0.0323, 1, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url:\n print('The file was uploaded successfully.')\n print('URL: %s' % url)\n return 0\n else:\n print('An error occurred. Your file was not uploaded.')\n print('Google Code upload server said: %s (%s)' % (reason, status))\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L238_C4", "label": "print()", "type": "expression", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [8, 2, 0.9597, 0.004, 2, 0.98, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The file was uploaded successfully.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L239_C4", "label": "print()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [8, 2, 0.9637, 0.004, 2, 0.98, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('URL: %s' % url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L240_C4", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [13, 2, 0.9677, 0.004, 2, 0.98, 0.4, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L242_C4", "label": "print()", "type": "expression", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [8, 2, 0.9758, 0.004, 2, 0.98, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('An error occurred. Your file was not uploaded.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L243_C4", "label": "print()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [8, 2, 0.9798, 0.004, 2, 0.98, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Google Code upload server said: %s (%s)' % (reason, status))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "vector": [13, 2, 0.9839, 0.004, 2, 0.98, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:If_L247_C0", "label": "if", "type": "if", "loc": [247, 248], "level": 0, "parent": null, "vector": [4, 0, 0.998, 0.0081, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n sys.exit(main())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L248_C2", "label": "exit()", "type": "expression", "loc": [248, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_777:If_L247_C0", "vector": [8, 1, 1.0, 0.004, 1, 0.97, 0.0, 436, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(main())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L107_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:For_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L175_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L176_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L177_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L180_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L181_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L182_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L183_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L184_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L192_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L193_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L202_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L204_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L206_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L218_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L224_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L227_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L229_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Assign_L234_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_777:If_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_777:Expr_L248_C2"}] |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
# uploading files to Google Code projects.
#
# To upload a file to Google Code, you need to provide a path to the
# file on your local machine, a small summary of what the file is, a
# project name, and a valid account that is a member or owner of that
# project. You can optionally provide a list of labels that apply to
# the file. The file will be uploaded under the same name that it has
# in your local filesystem (that is, the "basename" or last path
# component). Run the script with '--help' to get the exact syntax
# and available options.
#
# Note that the upload script requests that you enter your
# googlecode.com password. This is NOT your Gmail account password!
# This is the password you use on googlecode.com for committing to
# Subversion and uploading files. You can find your password by going
# to http://code.google.com/hosting/settings when logged in with your
# Gmail account. If you have already committed to your project's
# Subversion repository, the script will automatically retrieve your
# credentials from there (unless disabled, see the output of '--help'
# for details).
#
# If you are looking at this script as a reference for implementing
# your own Google Code file uploader, then you should take a look at
# the upload() function, which is the meat of the uploader. You
# basically need to build a multipart/form-data POST request with the
# right fields and send it to https://PROJECT.googlecode.com/files .
# Authenticate the request using HTTP Basic authentication, as is
# shown below.
#
# Licensed under the terms of the Apache Software License 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
#
# Questions, comments, feature requests and patches are most welcome.
# Please direct all of these to the Google Code users group:
# http://groups.google.com/group/google-code-hosting
"""Google Code file uploader script.
"""
__author__ = 'danderson@google.com (David Anderson)'
import httplib
import os.path
import optparse
import getpass
import base64
import sys
def upload(file, project_name, user_name, password, summary, labels=None):
"""Upload a file to a Google Code project's file server.
Args:
file: The local path to the file.
project_name: The name of your project on Google Code.
user_name: Your Google account name.
password: The googlecode.com password for your account.
Note that this is NOT your global Google Account password!
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
Returns: a tuple:
http_status: 201 if the upload succeeded, something else if an
error occured.
http_reason: The human-readable string associated with http_status
file_url: If the upload succeeded, the URL of the file on Google
Code, None otherwise.
"""
# The login is the user part of user@gmail.com. If the login provided
# is in the full user@domain form, strip it down.
if user_name.endswith('@gmail.com'):
user_name = user_name[:user_name.index('@gmail.com')]
form_fields = [('summary', summary)]
if labels is not None:
form_fields.extend([('label', l.strip()) for l in labels])
content_type, body = encode_upload_request(form_fields, file)
upload_host = '%s.googlecode.com' % project_name
upload_uri = '/files'
auth_token = base64.b64encode('%s:%s'% (user_name, password))
headers = {
'Authorization': 'Basic %s' % auth_token,
'User-Agent': 'Googlecode.com uploader v0.9.4',
'Content-Type': content_type,
}
server = httplib.HTTPSConnection(upload_host)
server.request('POST', upload_uri, body, headers)
resp = server.getresponse()
server.close()
if resp.status == 201:
location = resp.getheader('Location', None)
else:
location = None
return resp.status, resp.reason, location
def encode_upload_request(fields, file_path):
"""Encode the given fields and file into a multipart form body.
fields is a sequence of (name, value) pairs. file is the path of
the file to upload. The file will be uploaded to Google Code with
the same file name.
Returns: (content_type, body) ready for httplib.HTTP instance
"""
BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
CRLF = '\r\n'
body = []
# Add the metadata about the upload first
for key, value in fields:
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="%s"' % key,
'',
value,
])
# Now add the file itself
file_name = os.path.basename(file_path)
f = open(file_path, 'rb')
file_content = f.read()
f.close()
body.extend(
['--' + BOUNDARY,
'Content-Disposition: form-data; name="filename"; filename="%s"'
% file_name,
# The upload server determines the mime-type, no need to set it.
'Content-Type: application/octet-stream',
'',
file_content,
])
# Finalize the form body
body.extend(['--' + BOUNDARY + '--', ''])
return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
def upload_find_auth(file_path, project_name, summary, labels=None,
user_name=None, password=None, tries=3):
"""Find credentials and upload a file to a Google Code project's file server.
file_path, project_name, summary, and labels are passed as-is to upload.
Args:
file_path: The local path to the file.
project_name: The name of your project on Google Code.
summary: A small description for the file.
labels: an optional list of label strings with which to tag the file.
config_dir: Path to Subversion configuration directory, 'none', or None.
user_name: Your Google account name.
tries: How many attempts to make.
"""
while tries > 0:
if user_name is None:
# Read username if not specified or loaded from svn config, or on
# subsequent tries.
sys.stdout.write('Please enter your googlecode.com username: ')
sys.stdout.flush()
user_name = sys.stdin.readline().rstrip()
if password is None:
# Read password if not loaded from svn config, or on subsequent tries.
print 'Please enter your googlecode.com password.'
print '** Note that this is NOT your Gmail account password! **'
print 'It is the password you use to access Subversion repositories,'
print 'and can be found here: http://code.google.com/hosting/settings'
password = getpass.getpass()
status, reason, url = upload(file_path, project_name, user_name, password,
summary, labels)
# Returns 403 Forbidden instead of 401 Unauthorized for bad
# credentials as of 2007-07-17.
if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
# Rest for another try.
user_name = password = None
tries = tries - 1
else:
# We're done.
break
return status, reason, url
def main():
parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
'-p PROJECT [options] FILE')
parser.add_option('-s', '--summary', dest='summary',
help='Short description of the file')
parser.add_option('-p', '--project', dest='project',
help='Google Code project name')
parser.add_option('-u', '--user', dest='user',
help='Your Google Code username')
parser.add_option('-w', '--password', dest='password',
help='Your Google Code password')
parser.add_option('-l', '--labels', dest='labels',
help='An optional list of comma-separated labels to attach '
'to the file')
options, args = parser.parse_args()
if not options.summary:
parser.error('File summary is missing.')
elif not options.project:
parser.error('Project name is missing.')
elif len(args) < 1:
parser.error('File to upload not provided.')
elif len(args) > 1:
parser.error('Only one file may be specified.')
file_path = args[0]
if options.labels:
labels = options.labels.split(',')
else:
labels = None
status, reason, url = upload_find_auth(file_path, options.project,
options.summary, labels,
options.user, options.password)
if url:
print 'The file was uploaded successfully.'
print 'URL: %s' % url
return 0
else:
print 'An error occurred. Your file was not uploaded.'
print 'Google Code upload server said: %s (%s)' % (reason, status)
return 1
if __name__ == '__main__':
sys.exit(main())
| ajibawa-2023/Python-Code-Large/train/row_778 | 90 | 248 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L46_C0", "label": "expression", "type": "expression", "loc": [46, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1875, 0.0081, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Google Code file uploader script.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L49_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.1976, 0.004, 0, 0.66, 0.0833, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'danderson@google.com (David Anderson)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L51_C0", "label": "httplib import httplib", "type": "import", "loc": [51, 51], "level": 0, "parent": null, "vector": [1, 0, 0.2056, 0.004, 0, 0.66, 0.1667, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L52_C0", "label": "os.path import os.path", "type": "import", "loc": [52, 52], "level": 0, "parent": null, "vector": [1, 0, 0.2097, 0.004, 0, 0.66, 0.25, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["os.path"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L53_C0", "label": "optparse import optparse", "type": "import", "loc": [53, 53], "level": 0, "parent": null, "vector": [1, 0, 0.2137, 0.004, 0, 0.66, 0.3333, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L54_C0", "label": "getpass import getpass", "type": "import", "loc": [54, 54], "level": 0, "parent": null, "vector": [1, 0, 0.2177, 0.004, 0, 0.66, 0.4167, 784, 0, 1, 0, 0, 784, 0, 0], "semantic": {"name": "getpass", "arg_names": [], "import_names": ["getpass"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L55_C0", "label": "base64 import base64", "type": "import", "loc": [55, 55], "level": 0, "parent": null, "vector": [1, 0, 0.2218, 0.004, 0, 0.66, 0.5, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Import_L56_C0", "label": "sys import sys", "type": "import", "loc": [56, 56], "level": 0, "parent": null, "vector": [1, 0, 0.2258, 0.004, 0, 0.66, 0.5833, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "label": "upload", "type": "function", "loc": [59, 107], "level": 0, "parent": null, "vector": [2, 0, 0.3347, 0.1976, 0, 0.66, 0.6667, 920, 0, 6, 1, 0, 0, 0, 11], "semantic": {"name": "upload", "arg_names": ["file", "project_name", "user_name", "password", "summary", "labels"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload(file, project_name, user_name, password, summary, labels=None):\n \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [8, 1, 0.2762, 0.0726, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Upload a file to a Google Code project's file server.\n\n Args:\n file: The local path to the file.\n project_name: The name of your project on Google Code.\n user_name: Your Google account name.\n password: The googlecode.com password for your account.\n Note that this is NOT your global Google Account password!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L80_C2", "label": "if", "type": "if", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [4, 1, 0.3246, 0.0081, 1, 0.88, 0.0714, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name.endswith('@gmail.com'):\n user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L81_C4", "label": "user_name =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L80_C2", "vector": [14, 2, 0.3266, 0.004, 2, 0.62, 0.0, 3, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = user_name[:user_name.index('@gmail.com')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L83_C2", "label": "form_fields =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3347, 0.004, 1, 0.88, 0.1429, 486, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "form_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form_fields = [('summary', summary)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L84_C2", "label": "if", "type": "if", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [4, 1, 0.3407, 0.0081, 1, 0.88, 0.2143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if labels is not None:\n form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L85_C4", "label": "extend()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L84_C2", "vector": [8, 2, 0.3427, 0.004, 2, 0.44, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " form_fields.extend([('label', l.strip()) for l in labels])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L87_C2", "label": "content_type, body = encode_upload_request()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3508, 0.004, 1, 0.88, 0.2857, 433, 3, 2, 0, 0, 133, 10, 1], "semantic": {"name": "content_type, body", "arg_names": [], "import_names": [], "rhs_call_name": "encode_upload_request", "annotation": ""}, "snippet": " content_type, body = encode_upload_request(form_fields, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L89_C2", "label": "upload_host =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3589, 0.004, 1, 0.88, 0.3571, 380, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upload_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_host = '%s.googlecode.com' % project_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L90_C2", "label": "upload_uri =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3629, 0.004, 1, 0.88, 0.4286, 669, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "upload_uri", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upload_uri = '/files'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L91_C2", "label": "auth_token = b64encode()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3669, 0.004, 1, 0.88, 0.5, 958, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "auth_token", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " auth_token = base64.b64encode('%s:%s'% (user_name, password))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L92_C2", "label": "headers =", "type": "assigned_variable", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.379, 0.0202, 1, 0.88, 0.5714, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'Authorization': 'Basic %s' % auth_token,\n 'User-Agent': 'Googlecode.com uploader v0.9.4',\n 'Content-Type': content_type,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L98_C2", "label": "server = HTTPSConnection()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.3952, 0.004, 1, 0.88, 0.6429, 268, 3, 1, 0, 0, 40, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPSConnection", "annotation": ""}, "snippet": " server = httplib.HTTPSConnection(upload_host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L99_C2", "label": "request()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [8, 1, 0.3992, 0.004, 1, 0.88, 0.7143, 50, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " server.request('POST', upload_uri, body, headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L100_C2", "label": "resp = getresponse()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [14, 1, 0.4032, 0.004, 1, 0.88, 0.7857, 48, 3, 0, 0, 0, 47, 10, 1], "semantic": {"name": "resp", "arg_names": [], "import_names": [], "rhs_call_name": "getresponse", "annotation": ""}, "snippet": " resp = server.getresponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L101_C2", "label": "close()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [8, 1, 0.4073, 0.004, 1, 0.88, 0.8571, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " server.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2", "label": "if", "type": "if", "loc": [103, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [4, 1, 0.4214, 0.0161, 1, 0.88, 0.9286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp.status == 201:\n location = resp.getheader('Location', None)\n else:\n location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L104_C4", "label": "location = getheader()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2", "vector": [14, 2, 0.4194, 0.004, 2, 0.53, 0.0, 771, 3, 2, 0, 0, 644, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "getheader", "annotation": ""}, "snippet": " location = resp.getheader('Location', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L106_C4", "label": "location =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2", "vector": [14, 2, 0.4274, 0.004, 2, 0.53, 1.0, 771, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L107_C2", "label": "return", "type": "return", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "vector": [13, 1, 0.4315, 0.004, 1, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resp.status, resp.reason, location"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "label": "encode_upload_request", "type": "function", "loc": [110, 152], "level": 0, "parent": null, "vector": [2, 0, 0.5282, 0.1734, 0, 0.66, 0.75, 133, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "encode_upload_request", "arg_names": ["fields", "file_path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_upload_request(fields, file_path):\n \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L111_C2", "label": "expression", "type": "expression", "loc": [111, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [8, 1, 0.4617, 0.0323, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given fields and file into a multipart form body.\n\n fields is a sequence of (name, value) pairs. file is the path of\n the file to upload. The file will be uploaded to Google Code with\n the same file name.\n\n Returns: (content_type, body) ready for httplib.HTTP instance\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L119_C2", "label": "BOUNDARY =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.4798, 0.004, 1, 0.07, 0.0909, 677, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOUNDARY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L120_C2", "label": "CRLF =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.4839, 0.004, 1, 0.07, 0.1818, 646, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CRLF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CRLF = '\\r\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L122_C2", "label": "body =", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.4919, 0.004, 1, 0.07, 0.2727, 477, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:For_L125_C2", "label": "for key, value", "type": "for", "loc": [125, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [6, 1, 0.5161, 0.0282, 1, 0.07, 0.3636, 839, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in fields:\n body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L126_C4", "label": "extend()", "type": "expression", "loc": [126, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:For_L125_C2", "vector": [8, 2, 0.5181, 0.0242, 2, 0.63, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"%s\"' % key,\n '',\n value,\n ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L134_C2", "label": "file_name = basename()", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.5403, 0.004, 1, 0.07, 0.4545, 991, 3, 1, 0, 0, 164, 10, 1], "semantic": {"name": "file_name", "arg_names": [], "import_names": [], "rhs_call_name": "basename", "annotation": ""}, "snippet": " file_name = os.path.basename(file_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L135_C2", "label": "f = open()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.5444, 0.004, 1, 0.07, 0.5455, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(file_path, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L136_C2", "label": "file_content = read()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [14, 1, 0.5484, 0.004, 1, 0.07, 0.6364, 412, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "file_content", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " file_content = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L137_C2", "label": "close()", "type": "expression", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [8, 1, 0.5524, 0.004, 1, 0.07, 0.7273, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L139_C2", "label": "extend()", "type": "expression", "loc": [139, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [8, 1, 0.5766, 0.0363, 1, 0.07, 0.8182, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(\n ['--' + BOUNDARY,\n 'Content-Disposition: form-data; name=\"filename\"; filename=\"%s\"'\n % file_name,\n # The upload server determines the mime-type, no need to set it.\n 'Content-Type: application/octet-stream',\n '',\n file_content,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L150_C2", "label": "extend()", "type": "expression", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [8, 1, 0.6048, 0.004, 1, 0.07, 0.9091, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " body.extend(['--' + BOUNDARY + '--', ''])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L152_C2", "label": "return", "type": "return", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "vector": [13, 1, 0.6129, 0.004, 1, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "label": "upload_find_auth", "type": "function", "loc": [155, 198], "level": 0, "parent": null, "vector": [2, 0, 0.7117, 0.1774, 0, 0.66, 0.8333, 28, 0, 7, 1, 0, 0, 0, 10], "semantic": {"name": "upload_find_auth", "arg_names": ["file_path", "project_name", "summary", "labels", "user_name", "password", "tries"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def upload_find_auth(file_path, project_name, summary, labels=None,\n user_name=None, password=None, tries=3):\n \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L157_C2", "label": "expression", "type": "expression", "loc": [157, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "vector": [8, 1, 0.6573, 0.0524, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Find credentials and upload a file to a Google Code project's file server.\n\n file_path, project_name, summary, and labels are passed as-is to upload.\n\n Args:\n file_path: The local path to the file.\n project_name: The name of your project on Google Code.\n summary: A small description for the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "label": "while", "type": "while", "loc": [171, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "vector": [5, 1, 0.7399, 0.1048, 1, 0.54, 0.5, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while tries > 0:\n if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()\n if password is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "label": "if", "type": "if", "loc": [172, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "vector": [4, 2, 0.7036, 0.0242, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_name is None:\n # Read username if not specified or loaded from svn config, or on\n # subsequent tries.\n sys.stdout.write('Please enter your googlecode.com username: ')\n sys.stdout.flush()\n user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L175_C6", "label": "write()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "vector": [8, 3, 0.7056, 0.004, 3, 0.79, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write('Please enter your googlecode.com username: ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L176_C6", "label": "flush()", "type": "expression", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "vector": [8, 3, 0.7097, 0.004, 3, 0.79, 0.5, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " sys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L177_C6", "label": "user_name = rstrip()", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "vector": [14, 3, 0.7137, 0.004, 3, 0.79, 1.0, 3, 3, 0, 0, 0, 807, 10, 2], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "rstrip", "annotation": ""}, "snippet": " user_name = sys.stdin.readline().rstrip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "label": "if", "type": "if", "loc": [178, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "vector": [4, 2, 0.7298, 0.0282, 2, 0.63, 0.3333, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if password is None:\n # Read password if not loaded from svn config, or on subsequent tries.\n print('Please enter your googlecode.com password.')\n print('** Note that this is NOT your Gmail account password! **')\n print('It is the password you use to access Subversion repositories,')\n print('and can be found here: http://code.google.com/hosting/settings')\n password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L180_C6", "label": "print()", "type": "expression", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "vector": [8, 3, 0.7258, 0.004, 3, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please enter your googlecode.com password.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L181_C6", "label": "print()", "type": "expression", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "vector": [8, 3, 0.7298, 0.004, 3, 0.59, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('** Note that this is NOT your Gmail account password! **')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L182_C6", "label": "print()", "type": "expression", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "vector": [8, 3, 0.7339, 0.004, 3, 0.59, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('It is the password you use to access Subversion repositories,')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L183_C6", "label": "print()", "type": "expression", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "vector": [8, 3, 0.7379, 0.004, 3, 0.59, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('and can be found here: http://code.google.com/hosting/settings')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L184_C6", "label": "password = getpass()", "type": "assigned_variable", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "vector": [14, 3, 0.7419, 0.004, 3, 0.59, 1.0, 489, 3, 0, 0, 0, 784, 10, 1], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "getpass", "annotation": ""}, "snippet": " password = getpass.getpass()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L186_C4", "label": "status, reason, url = upload()", "type": "assigned_variable", "loc": [186, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "vector": [14, 2, 0.752, 0.0081, 2, 0.63, 0.6667, 92, 3, 6, 0, 0, 920, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload", "annotation": ""}, "snippet": " status, reason, url = upload(file_path, project_name, user_name, password,\n summary, labels)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4", "label": "if", "type": "if", "loc": [190, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "vector": [4, 2, 0.7782, 0.0282, 2, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:\n # Rest for another try.\n user_name = password = None\n tries = tries - 1\n else:\n # We're done.\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L192_C6", "label": "user_name =", "type": "assigned_variable", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4", "vector": [14, 3, 0.7742, 0.004, 3, 0.23, 0.0, 3, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "user_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_name = password = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L193_C6", "label": "tries =", "type": "assigned_variable", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4", "vector": [14, 3, 0.7782, 0.004, 3, 0.23, 1.0, 915, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tries", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tries = tries - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L198_C2", "label": "return", "type": "return", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "vector": [13, 1, 0.7984, 0.004, 1, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status, reason, url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "label": "main", "type": "function", "loc": [201, 244], "level": 0, "parent": null, "vector": [2, 0, 0.8972, 0.1774, 0, 0.66, 0.9167, 624, 0, 0, 1, 0, 0, 0, 19], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')\n parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')\n parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')\n parser.add_option('-u', '--user', dest='user',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L202_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [202, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [14, 1, 0.8165, 0.0081, 1, 0.11, 0.0, 968, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '\n '-p PROJECT [options] FILE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L204_C2", "label": "add_option()", "type": "expression", "loc": [204, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [8, 1, 0.8246, 0.0081, 1, 0.11, 0.0909, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-s', '--summary', dest='summary',\n help='Short description of the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L206_C2", "label": "add_option()", "type": "expression", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [8, 1, 0.8327, 0.0081, 1, 0.11, 0.1818, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-p', '--project', dest='project',\n help='Google Code project name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L208_C2", "label": "add_option()", "type": "expression", "loc": [208, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [8, 1, 0.8407, 0.0081, 1, 0.11, 0.2727, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-u', '--user', dest='user',\n help='Your Google Code username')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L210_C2", "label": "add_option()", "type": "expression", "loc": [210, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [8, 1, 0.8488, 0.0081, 1, 0.11, 0.3636, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-w', '--password', dest='password',\n help='Your Google Code password')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L212_C2", "label": "add_option()", "type": "expression", "loc": [212, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [8, 1, 0.8589, 0.0121, 1, 0.11, 0.4545, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-l', '--labels', dest='labels',\n help='An optional list of comma-separated labels to attach '\n 'to the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L216_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [14, 1, 0.871, 0.004, 1, 0.11, 0.5455, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " options, args = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2", "label": "if", "type": "if", "loc": [218, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [4, 1, 0.8931, 0.0323, 1, 0.11, 0.6364, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not options.summary:\n parser.error('File summary is missing.')\n elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L219_C4", "label": "error()", "type": "expression", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2", "vector": [8, 2, 0.8831, 0.004, 2, 0.22, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File summary is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2", "label": "if", "type": "if", "loc": [220, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2", "vector": [4, 2, 0.8972, 0.0242, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not options.project:\n parser.error('Project name is missing.')\n elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L221_C4", "label": "error()", "type": "expression", "loc": [221, 221], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2", "vector": [8, 3, 0.8911, 0.004, 3, 0.03, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Project name is missing.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2", "label": "if", "type": "if", "loc": [222, 225], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2", "vector": [4, 3, 0.9012, 0.0161, 3, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) < 1:\n parser.error('File to upload not provided.')\n elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L223_C4", "label": "error()", "type": "expression", "loc": [223, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2", "vector": [8, 4, 0.8992, 0.004, 4, 0.12, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('File to upload not provided.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L224_C2", "label": "if", "type": "if", "loc": [224, 225], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2", "vector": [4, 4, 0.9052, 0.0081, 4, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) > 1:\n parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L225_C4", "label": "error()", "type": "expression", "loc": [225, 225], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L224_C2", "vector": [8, 5, 0.9073, 0.004, 5, 0.42, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error('Only one file may be specified.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L227_C2", "label": "file_path =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [14, 1, 0.9153, 0.004, 1, 0.11, 0.7273, 397, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "file_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " file_path = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2", "label": "if", "type": "if", "loc": [229, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [4, 1, 0.9294, 0.0161, 1, 0.11, 0.8182, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.labels:\n labels = options.labels.split(',')\n else:\n labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L230_C4", "label": "labels = split()", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2", "vector": [14, 2, 0.9274, 0.004, 2, 0.05, 0.0, 283, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " labels = options.labels.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L232_C4", "label": "labels =", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2", "vector": [14, 2, 0.9355, 0.004, 2, 0.05, 1.0, 283, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "labels", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " labels = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L234_C2", "label": "status, reason, url = upload_find_auth()", "type": "assigned_variable", "loc": [234, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [14, 1, 0.9476, 0.0121, 1, 0.11, 0.9091, 92, 3, 6, 0, 0, 28, 10, 1], "semantic": {"name": "status, reason, url", "arg_names": [], "import_names": [], "rhs_call_name": "upload_find_auth", "annotation": ""}, "snippet": " status, reason, url = upload_find_auth(file_path, options.project,\n options.summary, labels,\n options.user, options.password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "label": "if", "type": "if", "loc": [237, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "vector": [4, 1, 0.9698, 0.0323, 1, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url:\n print('The file was uploaded successfully.')\n print('URL: %s' % url)\n return 0\n else:\n print('An error occurred. Your file was not uploaded.')\n print('Google Code upload server said: %s (%s)' % (reason, status))\n return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L238_C4", "label": "print()", "type": "expression", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [8, 2, 0.9597, 0.004, 2, 0.36, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The file was uploaded successfully.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L239_C4", "label": "print()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [8, 2, 0.9637, 0.004, 2, 0.36, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('URL: %s' % url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L240_C4", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [13, 2, 0.9677, 0.004, 2, 0.36, 0.4, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L242_C4", "label": "print()", "type": "expression", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [8, 2, 0.9758, 0.004, 2, 0.36, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('An error occurred. Your file was not uploaded.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L243_C4", "label": "print()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [8, 2, 0.9798, 0.004, 2, 0.36, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Google Code upload server said: %s (%s)' % (reason, status))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "vector": [13, 2, 0.9839, 0.004, 2, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:If_L247_C0", "label": "if", "type": "if", "loc": [247, 248], "level": 0, "parent": null, "vector": [4, 0, 0.998, 0.0081, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n sys.exit(main())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L248_C2", "label": "exit()", "type": "expression", "loc": [248, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_778:If_L247_C0", "vector": [8, 1, 1.0, 0.004, 1, 0.9, 0.0, 436, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(main())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L107_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:For_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L175_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L176_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L177_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L180_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L181_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L182_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L183_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L184_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:While_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L192_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L193_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L155_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L202_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L204_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L206_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L218_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L224_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L227_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L229_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Assign_L234_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L237_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_778:If_L247_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_778:Expr_L248_C2"}] |
#!/usr/bin/env python3
import random
class MastermindGame():
def __init__(self):
self._generated_string = ""
used_digits = set()
for i in range(4):
digit = random.randrange(0, 10, 1)
while digit in used_digits:
digit = random.randrange(0, 10, 1)
used_digits.add(digit)
self._generated_string += str(digit)
def guess(self, attempt_string):
if len(attempt_string) != len(self._generated_string):
return False
bulls = 0
cows = 0
used_digits = set()
for digit1, digit2 in zip(self._generated_string, attempt_string):
if digit1 == digit2:
bulls += 1
else:
used_digits.add(digit1)
for digit in attempt_string:
if digit in used_digits:
cows += 1
if bulls == 4:
return "Epic Win, bro!"
return (bulls, cows)
if __name__ == "__main__":
game = MastermindGame()
while 1:
s = input()
print(game.guess(s))
| ajibawa-2023/Python-Code-Large/train/row_779 | 29 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_779:Import_L2_C0", "label": "random import random", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "label": "MastermindGame", "type": "class", "loc": [5, 33], "level": 0, "parent": null, "vector": [3, 0, 0.475, 0.725, 0, 0.66, 0.5, 894, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "MastermindGame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MastermindGame():\n def __init__(self):\n self._generated_string = \"\"\n used_digits = set()\n for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "vector": [2, 1, 0.25, 0.225, 1, 0.96, 0.0, 555, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self._generated_string = \"\"\n used_digits = set()\n for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)\n used_digits.add(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L7_C8", "label": "self._generated_string =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "vector": [14, 2, 0.175, 0.025, 2, 0.55, 0.0, 757, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._generated_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._generated_string = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L8_C8", "label": "used_digits = set()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "vector": [14, 2, 0.2, 0.025, 2, 0.55, 0.5, 330, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "used_digits", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " used_digits = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "label": "for i", "type": "for", "loc": [9, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "vector": [6, 2, 0.2875, 0.15, 2, 0.55, 1.0, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)\n used_digits.add(digit)\n self._generated_string += str(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L10_C12", "label": "digit = randrange()", "type": "assigned_variable", "loc": [10, 10], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "vector": [14, 3, 0.25, 0.025, 3, 0.64, 0.0, 733, 3, 3, 0, 0, 28, 10, 1], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "randrange", "annotation": ""}, "snippet": " digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:While_L11_C12", "label": "while", "type": "while", "loc": [11, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "vector": [5, 3, 0.2875, 0.05, 3, 0.64, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while digit in used_digits:\n digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L12_C16", "label": "digit = randrange()", "type": "assigned_variable", "loc": [12, 12], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:While_L11_C12", "vector": [14, 4, 0.3, 0.025, 4, 0.09, 0.0, 733, 3, 3, 0, 0, 28, 10, 1], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "randrange", "annotation": ""}, "snippet": " digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L13_C12", "label": "add()", "type": "expression", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "vector": [8, 3, 0.325, 0.025, 3, 0.64, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " used_digits.add(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "label": "guess", "type": "function", "loc": [17, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "vector": [2, 1, 0.625, 0.425, 1, 0.96, 1.0, 129, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "guess", "arg_names": ["self", "attempt_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def guess(self, attempt_string):\n if len(attempt_string) != len(self._generated_string):\n return False\n bulls = 0\n cows = 0\n used_digits = set()\n for digit1, digit2 in zip(self._generated_string, attempt_string): \n if digit1 == digit2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:If_L18_C8", "label": "if", "type": "if", "loc": [18, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [4, 2, 0.4625, 0.05, 2, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(attempt_string) != len(self._generated_string):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L19_C12", "label": "return", "type": "return", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:If_L18_C8", "vector": [13, 3, 0.475, 0.025, 3, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L20_C8", "label": "bulls =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [14, 2, 0.5, 0.025, 2, 0.97, 0.1429, 667, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "bulls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bulls = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L21_C8", "label": "cows =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [14, 2, 0.525, 0.025, 2, 0.97, 0.2857, 124, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "cows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cows = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L22_C8", "label": "used_digits = set()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [14, 2, 0.55, 0.025, 2, 0.97, 0.4286, 330, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "used_digits", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " used_digits = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:For_L23_C8", "label": "for digit1, digit2", "type": "for", "loc": [23, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [6, 2, 0.625, 0.125, 2, 0.97, 0.5714, 87, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "digit1, digit2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for digit1, digit2 in zip(self._generated_string, attempt_string): \n if digit1 == digit2:\n bulls += 1\n else:\n used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:If_L24_C12", "label": "if", "type": "if", "loc": [24, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:For_L23_C8", "vector": [4, 3, 0.6375, 0.1, 3, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if digit1 == digit2:\n bulls += 1\n else:\n used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L27_C16", "label": "add()", "type": "expression", "loc": [27, 27], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:If_L24_C12", "vector": [8, 4, 0.675, 0.025, 4, 0.45, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:For_L28_C8", "label": "for digit", "type": "for", "loc": [28, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [6, 2, 0.725, 0.075, 2, 0.97, 0.7143, 733, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for digit in attempt_string:\n if digit in used_digits:\n cows += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:If_L29_C12", "label": "if", "type": "if", "loc": [29, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:For_L28_C8", "vector": [4, 3, 0.7375, 0.05, 3, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if digit in used_digits:\n cows += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:If_L31_C8", "label": "if", "type": "if", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [4, 2, 0.7875, 0.05, 2, 0.97, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bulls == 4:\n return \"Epic Win, bro!\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L32_C12", "label": "return", "type": "return", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:If_L31_C8", "vector": [13, 3, 0.8, 0.025, 3, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"Epic Win, bro!\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L33_C8", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "vector": [13, 2, 0.825, 0.025, 2, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (bulls, cows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:If_L35_C0", "label": "if", "type": "if", "loc": [35, 39], "level": 0, "parent": null, "vector": [4, 0, 0.925, 0.125, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n game = MastermindGame()\n while 1:\n s = input()\n print(game.guess(s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L36_C4", "label": "game = MastermindGame()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:If_L35_C0", "vector": [14, 1, 0.9, 0.025, 1, 0.67, 0.0, 339, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "game", "arg_names": [], "import_names": [], "rhs_call_name": "MastermindGame", "annotation": ""}, "snippet": " game = MastermindGame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4", "label": "while", "type": "while", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:If_L35_C0", "vector": [5, 1, 0.95, 0.075, 1, 0.67, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n s = input()\n print(game.guess(s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L38_C8", "label": "s = input()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4", "vector": [14, 2, 0.95, 0.025, 2, 0.72, 0.0, 553, 3, 0, 0, 0, 930, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "input", "annotation": ""}, "snippet": " s = input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L39_C8", "label": "print()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4", "vector": [8, 2, 0.975, 0.025, 2, 0.72, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(game.guess(s))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:While_L11_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:While_L11_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L12_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:For_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:For_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:If_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:If_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L27_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:For_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:If_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Return_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_779:While_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_779:Expr_L39_C8"}] |
#!/usr/bin/env python3
import random
class MastermindGame():
def __init__(self):
self._generated_string = ""
used_digits = set()
for i in range(4):
digit = random.randrange(0, 10, 1)
while digit in used_digits:
digit = random.randrange(0, 10, 1)
used_digits.add(digit)
self._generated_string += str(digit)
def guess(self, attempt_string):
if len(attempt_string) != len(self._generated_string):
return False
bulls = 0
cows = 0
used_digits = set()
for digit1, digit2 in zip(self._generated_string, attempt_string):
if digit1 == digit2:
bulls += 1
else:
used_digits.add(digit1)
for digit in attempt_string:
if digit in used_digits:
cows += 1
if bulls == 4:
return "Epic Win, bro!"
return (bulls, cows)
if __name__ == "__main__":
game = MastermindGame()
while 1:
s = input()
print(game.guess(s))
| ajibawa-2023/Python-Code-Large/train/row_780 | 29 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_780:Import_L2_C0", "label": "random import random", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "label": "MastermindGame", "type": "class", "loc": [5, 33], "level": 0, "parent": null, "vector": [3, 0, 0.475, 0.725, 0, 0.66, 0.5, 894, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "MastermindGame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MastermindGame():\n def __init__(self):\n self._generated_string = \"\"\n used_digits = set()\n for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "vector": [2, 1, 0.25, 0.225, 1, 0.68, 0.0, 555, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self._generated_string = \"\"\n used_digits = set()\n for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)\n used_digits.add(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L7_C8", "label": "self._generated_string =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "vector": [14, 2, 0.175, 0.025, 2, 0.56, 0.0, 757, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._generated_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._generated_string = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L8_C8", "label": "used_digits = set()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "vector": [14, 2, 0.2, 0.025, 2, 0.56, 0.5, 330, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "used_digits", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " used_digits = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "label": "for i", "type": "for", "loc": [9, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "vector": [6, 2, 0.2875, 0.15, 2, 0.56, 1.0, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(4):\n digit = random.randrange(0, 10, 1)\n while digit in used_digits:\n digit = random.randrange(0, 10, 1)\n used_digits.add(digit)\n self._generated_string += str(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L10_C12", "label": "digit = randrange()", "type": "assigned_variable", "loc": [10, 10], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "vector": [14, 3, 0.25, 0.025, 3, 0.12, 0.0, 733, 3, 3, 0, 0, 28, 10, 1], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "randrange", "annotation": ""}, "snippet": " digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:While_L11_C12", "label": "while", "type": "while", "loc": [11, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "vector": [5, 3, 0.2875, 0.05, 3, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while digit in used_digits:\n digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L12_C16", "label": "digit = randrange()", "type": "assigned_variable", "loc": [12, 12], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:While_L11_C12", "vector": [14, 4, 0.3, 0.025, 4, 0.83, 0.0, 733, 3, 3, 0, 0, 28, 10, 1], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "randrange", "annotation": ""}, "snippet": " digit = random.randrange(0, 10, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L13_C12", "label": "add()", "type": "expression", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "vector": [8, 3, 0.325, 0.025, 3, 0.12, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " used_digits.add(digit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "label": "guess", "type": "function", "loc": [17, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "vector": [2, 1, 0.625, 0.425, 1, 0.68, 1.0, 129, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "guess", "arg_names": ["self", "attempt_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def guess(self, attempt_string):\n if len(attempt_string) != len(self._generated_string):\n return False\n bulls = 0\n cows = 0\n used_digits = set()\n for digit1, digit2 in zip(self._generated_string, attempt_string): \n if digit1 == digit2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:If_L18_C8", "label": "if", "type": "if", "loc": [18, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [4, 2, 0.4625, 0.05, 2, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(attempt_string) != len(self._generated_string):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L19_C12", "label": "return", "type": "return", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:If_L18_C8", "vector": [13, 3, 0.475, 0.025, 3, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L20_C8", "label": "bulls =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [14, 2, 0.5, 0.025, 2, 0.29, 0.1429, 667, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "bulls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bulls = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L21_C8", "label": "cows =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [14, 2, 0.525, 0.025, 2, 0.29, 0.2857, 124, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "cows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cows = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L22_C8", "label": "used_digits = set()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [14, 2, 0.55, 0.025, 2, 0.29, 0.4286, 330, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "used_digits", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " used_digits = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:For_L23_C8", "label": "for digit1, digit2", "type": "for", "loc": [23, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [6, 2, 0.625, 0.125, 2, 0.29, 0.5714, 87, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "digit1, digit2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for digit1, digit2 in zip(self._generated_string, attempt_string): \n if digit1 == digit2:\n bulls += 1\n else:\n used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:If_L24_C12", "label": "if", "type": "if", "loc": [24, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:For_L23_C8", "vector": [4, 3, 0.6375, 0.1, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if digit1 == digit2:\n bulls += 1\n else:\n used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L27_C16", "label": "add()", "type": "expression", "loc": [27, 27], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:If_L24_C12", "vector": [8, 4, 0.675, 0.025, 4, 0.47, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " used_digits.add(digit1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:For_L28_C8", "label": "for digit", "type": "for", "loc": [28, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [6, 2, 0.725, 0.075, 2, 0.29, 0.7143, 733, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "digit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for digit in attempt_string:\n if digit in used_digits:\n cows += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:If_L29_C12", "label": "if", "type": "if", "loc": [29, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:For_L28_C8", "vector": [4, 3, 0.7375, 0.05, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if digit in used_digits:\n cows += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:If_L31_C8", "label": "if", "type": "if", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [4, 2, 0.7875, 0.05, 2, 0.29, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bulls == 4:\n return \"Epic Win, bro!\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L32_C12", "label": "return", "type": "return", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:If_L31_C8", "vector": [13, 3, 0.8, 0.025, 3, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"Epic Win, bro!\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L33_C8", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "vector": [13, 2, 0.825, 0.025, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (bulls, cows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:If_L35_C0", "label": "if", "type": "if", "loc": [35, 39], "level": 0, "parent": null, "vector": [4, 0, 0.925, 0.125, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n game = MastermindGame()\n while 1:\n s = input()\n print(game.guess(s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L36_C4", "label": "game = MastermindGame()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:If_L35_C0", "vector": [14, 1, 0.9, 0.025, 1, 0.79, 0.0, 339, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "game", "arg_names": [], "import_names": [], "rhs_call_name": "MastermindGame", "annotation": ""}, "snippet": " game = MastermindGame()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4", "label": "while", "type": "while", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:If_L35_C0", "vector": [5, 1, 0.95, 0.075, 1, 0.79, 1.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n s = input()\n print(game.guess(s))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L38_C8", "label": "s = input()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4", "vector": [14, 2, 0.95, 0.025, 2, 0.31, 0.0, 553, 3, 0, 0, 0, 930, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "input", "annotation": ""}, "snippet": " s = input()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L39_C8", "label": "print()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4", "vector": [8, 2, 0.975, 0.025, 2, 0.31, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(game.guess(s))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L10_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:While_L11_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:While_L11_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L12_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:For_L9_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:For_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:For_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:If_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:If_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L27_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:For_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:If_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:If_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:If_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Return_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_780:While_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_780:Expr_L39_C8"}] |
import time
def yesno(question):
val = raw_input(question + " ")
return val.startswith("y") or val.startswith("Y")
use_pysqlite2 = yesno("Use pysqlite 2.0?")
use_autocommit = yesno("Use autocommit?")
use_executemany= yesno("Use executemany?")
if use_pysqlite2:
from pysqlite2 import dbapi2 as sqlite
else:
import sqlite
def create_db():
con = sqlite.connect(":memory:")
if use_autocommit:
if use_pysqlite2:
con.isolation_level = None
else:
con.autocommit = True
cur = con.cursor()
cur.execute("""
create table test(v text, f float, i integer)
""")
cur.close()
return con
def test():
row = ("sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd", 3.14, 42)
l = []
for i in range(1000):
l.append(row)
con = create_db()
cur = con.cursor()
if sqlite.version_info > (2, 0):
sql = "insert into test(v, f, i) values (?, ?, ?)"
else:
sql = "insert into test(v, f, i) values (%s, %s, %s)"
starttime = time.time()
for i in range(50):
if use_executemany:
cur.executemany(sql, l)
else:
for r in l:
cur.execute(sql, r)
endtime = time.time()
print "elapsed", endtime - starttime
cur.execute("select count(*) from test")
print "rows:", cur.fetchone()[0]
if __name__ == "__main__":
test()
| ajibawa-2023/Python-Code-Large/train/row_781 | 42 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_781:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "label": "yesno", "type": "function", "loc": [3, 5], "level": 0, "parent": null, "vector": [2, 0, 0.0656, 0.0492, 0, 0.66, 0.125, 796, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "yesno", "arg_names": ["question"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L4_C4", "label": "val = raw_input()", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "vector": [14, 1, 0.0656, 0.0164, 1, 0.85, 0.0, 618, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " val = raw_input(question + \" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "vector": [13, 1, 0.082, 0.0164, 1, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L7_C0", "label": "use_pysqlite2 = yesno()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1148, 0.0164, 0, 0.66, 0.25, 516, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_pysqlite2", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L8_C0", "label": "use_autocommit = yesno()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.1311, 0.0164, 0, 0.66, 0.375, 788, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_autocommit", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_autocommit = yesno(\"Use autocommit?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L9_C0", "label": "use_executemany = yesno()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1475, 0.0164, 0, 0.66, 0.5, 502, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_executemany", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_executemany= yesno(\"Use executemany?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L11_C0", "label": "if", "type": "if", "loc": [11, 14], "level": 0, "parent": null, "vector": [4, 0, 0.2049, 0.0656, 0, 0.66, 0.625, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n from pysqlite2 import dbapi2 as sqlite\nelse:\n import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:ImportFrom_L12_C4", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L11_C0", "vector": [1, 1, 0.1967, 0.0164, 1, 0.24, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Import_L14_C4", "label": "sqlite import sqlite", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L11_C0", "vector": [1, 1, 0.2295, 0.0164, 1, 0.24, 1.0, 301, 0, 1, 0, 0, 301, 0, 0], "semantic": {"name": "sqlite", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "label": "create_db", "type": "function", "loc": [17, 29], "level": 0, "parent": null, "vector": [2, 0, 0.377, 0.2131, 0, 0.66, 0.75, 487, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "create_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_db():\n con = sqlite.connect(\":memory:\")\n if use_autocommit:\n if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L18_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [14, 1, 0.2951, 0.0164, 1, 0.84, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L19_C4", "label": "if", "type": "if", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [4, 1, 0.3443, 0.082, 1, 0.84, 0.2, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_autocommit:\n if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8", "label": "if", "type": "if", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L19_C4", "vector": [4, 2, 0.3525, 0.0656, 2, 0.97, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_pysqlite2:\n con.isolation_level = None\n else:\n con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L21_C12", "label": "con.isolation_level =", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8", "vector": [14, 3, 0.3443, 0.0164, 3, 0.27, 0.0, 91, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "con.isolation_level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.isolation_level = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L23_C12", "label": "con.autocommit =", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8", "vector": [14, 3, 0.377, 0.0164, 3, 0.27, 1.0, 13, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "con.autocommit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.autocommit = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L24_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [14, 1, 0.3934, 0.0164, 1, 0.84, 0.4, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L25_C4", "label": "execute()", "type": "expression", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [8, 1, 0.4262, 0.0492, 1, 0.84, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"\"\"\n create table test(v text, f float, i integer)\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L28_C4", "label": "close()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [8, 1, 0.459, 0.0164, 1, 0.84, 0.8, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "vector": [13, 1, 0.4754, 0.0164, 1, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return con"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "label": "test", "type": "function", "loc": [31, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7213, 0.4426, 0, 0.66, 0.875, 224, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)\n l = []\n for i in range(1000):\n l.append(row)\n\n con = create_db()\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L32_C4", "label": "row =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.5246, 0.0164, 1, 0.73, 0.0, 767, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L33_C4", "label": "l =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.541, 0.0164, 1, 0.73, 0.0909, 810, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:For_L34_C4", "label": "for i", "type": "for", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [6, 1, 0.5656, 0.0328, 1, 0.73, 0.1818, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1000):\n l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L35_C8", "label": "append()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:For_L34_C4", "vector": [8, 2, 0.5738, 0.0164, 2, 0.21, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L37_C4", "label": "con = create_db()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.6066, 0.0164, 1, 0.73, 0.2727, 761, 3, 0, 0, 0, 487, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "create_db", "annotation": ""}, "snippet": " con = create_db()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L38_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.623, 0.0164, 1, 0.73, 0.3636, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4", "label": "if", "type": "if", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [4, 1, 0.6803, 0.0656, 1, 0.73, 0.4545, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n sql = \"insert into test(v, f, i) values (?, ?, ?)\"\n else:\n sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L41_C8", "label": "sql =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4", "vector": [14, 2, 0.6721, 0.0164, 2, 0.41, 0.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (?, ?, ?)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L43_C8", "label": "sql =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4", "vector": [14, 2, 0.7049, 0.0164, 2, 0.41, 1.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L45_C4", "label": "starttime = time()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.7377, 0.0164, 1, 0.73, 0.5455, 864, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "starttime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " starttime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:For_L46_C4", "label": "for i", "type": "for", "loc": [46, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [6, 1, 0.7951, 0.0984, 1, 0.73, 0.6364, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n if use_executemany:\n cur.executemany(sql, l)\n else:\n for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8", "label": "if", "type": "if", "loc": [47, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:For_L46_C4", "vector": [4, 2, 0.8033, 0.082, 2, 0.78, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_executemany:\n cur.executemany(sql, l)\n else:\n for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L48_C12", "label": "executemany()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8", "vector": [8, 3, 0.7869, 0.0164, 3, 0.78, 0.0, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:For_L50_C12", "label": "for r", "type": "for", "loc": [50, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8", "vector": [6, 3, 0.8279, 0.0328, 3, 0.78, 1.0, 436, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in l:\n cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L51_C16", "label": "execute()", "type": "expression", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:For_L50_C12", "vector": [8, 4, 0.8361, 0.0164, 4, 0.87, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(sql, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L52_C4", "label": "endtime = time()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [14, 1, 0.8525, 0.0164, 1, 0.73, 0.7273, 975, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "endtime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " endtime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L54_C4", "label": "print()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [8, 1, 0.8852, 0.0164, 1, 0.73, 0.8182, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"elapsed\", endtime - starttime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L56_C4", "label": "execute()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [8, 1, 0.918, 0.0164, 1, 0.73, 0.9091, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select count(*) from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L57_C4", "label": "print()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "vector": [8, 1, 0.9344, 0.0164, 1, 0.73, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"rows:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:If_L59_C0", "label": "if", "type": "if", "loc": [59, 60], "level": 0, "parent": null, "vector": [4, 0, 0.9754, 0.0328, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L60_C4", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_781:If_L59_C0", "vector": [8, 1, 0.9836, 0.0164, 1, 0.72, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:ImportFrom_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:For_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:For_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:For_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:For_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_781:For_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:For_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L51_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_781:If_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_781:Expr_L60_C4"}] |
import time
def yesno(question):
val = raw_input(question + " ")
return val.startswith("y") or val.startswith("Y")
use_pysqlite2 = yesno("Use pysqlite 2.0?")
if use_pysqlite2:
use_custom_types = yesno("Use custom types?")
use_dictcursor = yesno("Use dict cursor?")
use_rowcursor = yesno("Use row cursor?")
else:
use_tuple = yesno("Use rowclass=tuple?")
if use_pysqlite2:
from pysqlite2 import dbapi2 as sqlite
else:
import sqlite
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
if use_pysqlite2:
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
class DictCursor(sqlite.Cursor):
def __init__(self, *args, **kwargs):
sqlite.Cursor.__init__(self, *args, **kwargs)
self.row_factory = dict_factory
class RowCursor(sqlite.Cursor):
def __init__(self, *args, **kwargs):
sqlite.Cursor.__init__(self, *args, **kwargs)
self.row_factory = sqlite.Row
def create_db():
if sqlite.version_info > (2, 0):
if use_custom_types:
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)
sqlite.register_converter("text", lambda x: "<%s>" % x)
else:
con = sqlite.connect(":memory:")
if use_dictcursor:
cur = con.cursor(factory=DictCursor)
elif use_rowcursor:
cur = con.cursor(factory=RowCursor)
else:
cur = con.cursor()
else:
if use_tuple:
con = sqlite.connect(":memory:")
con.rowclass = tuple
cur = con.cursor()
else:
con = sqlite.connect(":memory:")
cur = con.cursor()
cur.execute("""
create table test(v text, f float, i integer)
""")
return (con, cur)
def test():
row = ("sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd", 3.14, 42)
l = []
for i in range(1000):
l.append(row)
con, cur = create_db()
if sqlite.version_info > (2, 0):
sql = "insert into test(v, f, i) values (?, ?, ?)"
else:
sql = "insert into test(v, f, i) values (%s, %s, %s)"
for i in range(50):
cur.executemany(sql, l)
cur.execute("select count(*) as cnt from test")
starttime = time.time()
for i in range(50):
cur.execute("select v, f, i from test")
l = cur.fetchall()
endtime = time.time()
print "elapsed:", endtime - starttime
if __name__ == "__main__":
test()
| ajibawa-2023/Python-Code-Large/train/row_782 | 71 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_782:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0103, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "label": "yesno", "type": "function", "loc": [3, 5], "level": 0, "parent": null, "vector": [2, 0, 0.0412, 0.0309, 0, 0.66, 0.1111, 796, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "yesno", "arg_names": ["question"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def yesno(question):\n val = raw_input(question + \" \")\n return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L4_C4", "label": "val = raw_input()", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "vector": [14, 1, 0.0412, 0.0103, 1, 0.98, 0.0, 618, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " val = raw_input(question + \" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "vector": [13, 1, 0.0515, 0.0103, 1, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.startswith(\"y\") or val.startswith(\"Y\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L7_C0", "label": "use_pysqlite2 = yesno()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0722, 0.0103, 0, 0.66, 0.2222, 516, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_pysqlite2", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": "use_pysqlite2 = yesno(\"Use pysqlite 2.0?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "label": "if", "type": "if", "loc": [8, 13], "level": 0, "parent": null, "vector": [4, 0, 0.1082, 0.0619, 0, 0.66, 0.3333, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n use_custom_types = yesno(\"Use custom types?\")\n use_dictcursor = yesno(\"Use dict cursor?\")\n use_rowcursor = yesno(\"Use row cursor?\")\nelse:\n use_tuple = yesno(\"Use rowclass=tuple?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L9_C4", "label": "use_custom_types = yesno()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "vector": [14, 1, 0.0928, 0.0103, 1, 0.31, 0.0, 719, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_custom_types", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_custom_types = yesno(\"Use custom types?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L10_C4", "label": "use_dictcursor = yesno()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "vector": [14, 1, 0.1031, 0.0103, 1, 0.31, 0.3333, 915, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_dictcursor", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_dictcursor = yesno(\"Use dict cursor?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L11_C4", "label": "use_rowcursor = yesno()", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "vector": [14, 1, 0.1134, 0.0103, 1, 0.31, 0.6667, 606, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_rowcursor", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_rowcursor = yesno(\"Use row cursor?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L13_C4", "label": "use_tuple = yesno()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "vector": [14, 1, 0.134, 0.0103, 1, 0.31, 1.0, 310, 3, 1, 0, 0, 796, 10, 1], "semantic": {"name": "use_tuple", "arg_names": [], "import_names": [], "rhs_call_name": "yesno", "annotation": ""}, "snippet": " use_tuple = yesno(\"Use rowclass=tuple?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L15_C0", "label": "if", "type": "if", "loc": [15, 18], "level": 0, "parent": null, "vector": [4, 0, 0.1701, 0.0412, 0, 0.66, 0.4444, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n from pysqlite2 import dbapi2 as sqlite\nelse:\n import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:ImportFrom_L16_C4", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L15_C0", "vector": [1, 1, 0.1649, 0.0103, 1, 0.22, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Import_L18_C4", "label": "sqlite import sqlite", "type": "import", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L15_C0", "vector": [1, 1, 0.1856, 0.0103, 1, 0.22, 1.0, 301, 0, 1, 0, 0, 301, 0, 0], "semantic": {"name": "sqlite", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "label": "dict_factory", "type": "function", "loc": [20, 24], "level": 0, "parent": null, "vector": [2, 0, 0.2268, 0.0515, 0, 0.66, 0.5556, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L21_C4", "label": "d =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "vector": [14, 1, 0.2165, 0.0103, 1, 0.2, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:For_L22_C4", "label": "for idx, col", "type": "for", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "vector": [6, 1, 0.232, 0.0206, 1, 0.2, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L23_C8", "label": "assign", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L22_C4", "vector": [14, 2, 0.2371, 0.0103, 2, 0.87, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "vector": [13, 1, 0.2474, 0.0103, 1, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "label": "if", "type": "if", "loc": [26, 41], "level": 0, "parent": null, "vector": [4, 0, 0.3454, 0.1649, 0, 0.66, 0.6667, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if use_pysqlite2:\n def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d\n\n class DictCursor(sqlite.Cursor):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "label": "dict_factory", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "vector": [2, 1, 0.299, 0.0515, 1, 0.28, 0.0, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L28_C8", "label": "d =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "vector": [14, 2, 0.2887, 0.0103, 2, 0.23, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:For_L29_C8", "label": "for idx, col", "type": "for", "loc": [29, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "vector": [6, 2, 0.3041, 0.0206, 2, 0.23, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L30_C12", "label": "assign", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L29_C8", "vector": [14, 3, 0.3093, 0.0103, 3, 0.1, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L31_C8", "label": "return", "type": "return", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "vector": [13, 2, 0.3196, 0.0103, 2, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L33_C4", "label": "DictCursor", "type": "class", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "vector": [3, 1, 0.3557, 0.0412, 1, 0.28, 0.5, 672, 0, 1, 0, 0, 669, 0, 1], "semantic": {"name": "DictCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class DictCursor(sqlite.Cursor):\n def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8", "label": "__init__", "type": "function", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L33_C4", "vector": [2, 2, 0.3608, 0.0309, 2, 0.31, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L35_C12", "label": "__init__()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8", "vector": [8, 3, 0.3608, 0.0103, 3, 0.14, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite.Cursor.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L36_C12", "label": "self.row_factory =", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8", "vector": [14, 3, 0.3711, 0.0103, 3, 0.14, 1.0, 832, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L38_C4", "label": "RowCursor", "type": "class", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "vector": [3, 1, 0.4072, 0.0412, 1, 0.28, 1.0, 193, 0, 1, 0, 0, 669, 0, 1], "semantic": {"name": "RowCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class RowCursor(sqlite.Cursor):\n def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8", "label": "__init__", "type": "function", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L38_C4", "vector": [2, 2, 0.4124, 0.0309, 2, 0.25, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n sqlite.Cursor.__init__(self, *args, **kwargs)\n self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L40_C12", "label": "__init__()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8", "vector": [8, 3, 0.4124, 0.0103, 3, 0.67, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite.Cursor.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L41_C12", "label": "self.row_factory =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8", "vector": [14, 3, 0.4227, 0.0103, 3, 0.67, 1.0, 832, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.row_factory = sqlite.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "label": "create_db", "type": "function", "loc": [43, 67], "level": 0, "parent": null, "vector": [2, 0, 0.567, 0.2577, 0, 0.66, 0.7778, 487, 0, 0, 1, 0, 0, 0, 11], "semantic": {"name": "create_db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_db():\n if sqlite.version_info > (2, 0):\n if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")\n if use_dictcursor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "label": "if", "type": "if", "loc": [44, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "vector": [4, 1, 0.5515, 0.2062, 1, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")\n if use_dictcursor:\n cur = con.cursor(factory=DictCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "label": "if", "type": "if", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "vector": [4, 2, 0.4845, 0.0515, 2, 0.61, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_custom_types:\n con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)\n sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)\n else:\n con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L46_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "vector": [14, 3, 0.4742, 0.0103, 3, 0.83, 0.0, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\", detect_types=sqlite.PARSE_DECLTYPES|sqlite.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L47_C12", "label": "register_converter()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "vector": [8, 3, 0.4845, 0.0103, 3, 0.83, 0.5, 121, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_converter", "arg_names": [], "import_names": [], "rhs_call_name": "register_converter", "annotation": ""}, "snippet": " sqlite.register_converter(\"text\", lambda x: \"<%s>\" % x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L49_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "vector": [14, 3, 0.5052, 0.0103, 3, 0.83, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8", "label": "if", "type": "if", "loc": [50, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "vector": [4, 2, 0.5412, 0.0619, 2, 0.61, 0.5, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_dictcursor:\n cur = con.cursor(factory=DictCursor)\n elif use_rowcursor:\n cur = con.cursor(factory=RowCursor)\n else:\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L51_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8", "vector": [14, 3, 0.5258, 0.0103, 3, 0.36, 0.0, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(factory=DictCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8", "vector": [4, 3, 0.5515, 0.0412, 3, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif use_rowcursor:\n cur = con.cursor(factory=RowCursor)\n else:\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L53_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8", "vector": [14, 4, 0.5464, 0.0103, 4, 0.89, 0.0, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(factory=RowCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L55_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8", "vector": [14, 4, 0.567, 0.0103, 4, 0.89, 1.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "label": "if", "type": "if", "loc": [57, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "vector": [4, 2, 0.6186, 0.0722, 2, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if use_tuple:\n con = sqlite.connect(\":memory:\")\n con.rowclass = tuple\n cur = con.cursor()\n else:\n con = sqlite.connect(\":memory:\")\n cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L58_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "vector": [14, 3, 0.5979, 0.0103, 3, 0.91, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L59_C12", "label": "con.rowclass =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "vector": [14, 3, 0.6082, 0.0103, 3, 0.91, 0.25, 907, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.rowclass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " con.rowclass = tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L60_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "vector": [14, 3, 0.6186, 0.0103, 3, 0.91, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L62_C12", "label": "con = connect()", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "vector": [14, 3, 0.6392, 0.0103, 3, 0.91, 0.75, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L63_C12", "label": "cur = cursor()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "vector": [14, 3, 0.6495, 0.0103, 3, 0.91, 1.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L64_C4", "label": "execute()", "type": "expression", "loc": [64, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "vector": [8, 1, 0.6701, 0.0309, 1, 0.78, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"\"\"\n create table test(v text, f float, i integer)\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L67_C4", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "vector": [13, 1, 0.6907, 0.0103, 1, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (con, cur)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "label": "test", "type": "function", "loc": [69, 93], "level": 0, "parent": null, "vector": [2, 0, 0.8351, 0.2577, 0, 0.66, 0.8889, 224, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)\n l = []\n for i in range(1000):\n l.append(row)\n\n con, cur = create_db()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L70_C4", "label": "row =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [14, 1, 0.7216, 0.0103, 1, 0.09, 0.0, 767, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = (\"sdfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffasfd\", 3.14, 42)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L71_C4", "label": "l =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [14, 1, 0.732, 0.0103, 1, 0.09, 0.1, 810, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:For_L72_C4", "label": "for i", "type": "for", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [6, 1, 0.7474, 0.0206, 1, 0.09, 0.2, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1000):\n l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L73_C8", "label": "append()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L72_C4", "vector": [8, 2, 0.7526, 0.0103, 2, 0.22, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " l.append(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L75_C4", "label": "con, cur = create_db()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [14, 1, 0.7732, 0.0103, 1, 0.09, 0.3, 349, 3, 0, 0, 0, 487, 10, 1], "semantic": {"name": "con, cur", "arg_names": [], "import_names": [], "rhs_call_name": "create_db", "annotation": ""}, "snippet": " con, cur = create_db()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4", "label": "if", "type": "if", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [4, 1, 0.8093, 0.0412, 1, 0.09, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sqlite.version_info > (2, 0):\n sql = \"insert into test(v, f, i) values (?, ?, ?)\"\n else:\n sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L78_C8", "label": "sql =", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4", "vector": [14, 2, 0.8041, 0.0103, 2, 0.25, 0.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (?, ?, ?)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L80_C8", "label": "sql =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4", "vector": [14, 2, 0.8247, 0.0103, 2, 0.25, 1.0, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sql = \"insert into test(v, f, i) values (%s, %s, %s)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:For_L82_C4", "label": "for i", "type": "for", "loc": [82, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [6, 1, 0.8505, 0.0206, 1, 0.09, 0.5, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L83_C8", "label": "executemany()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L82_C4", "vector": [8, 2, 0.8557, 0.0103, 2, 0.68, 0.0, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(sql, l)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L85_C4", "label": "execute()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [8, 1, 0.8763, 0.0103, 1, 0.09, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select count(*) as cnt from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L87_C4", "label": "starttime = time()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [14, 1, 0.8969, 0.0103, 1, 0.09, 0.7, 864, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "starttime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " starttime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4", "label": "for i", "type": "for", "loc": [88, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [6, 1, 0.9175, 0.0309, 1, 0.09, 0.8, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(50):\n cur.execute(\"select v, f, i from test\")\n l = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L89_C8", "label": "execute()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4", "vector": [8, 2, 0.9175, 0.0103, 2, 0.94, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select v, f, i from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L90_C8", "label": "l = fetchall()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4", "vector": [14, 2, 0.9278, 0.0103, 2, 0.94, 1.0, 810, 3, 0, 0, 0, 133, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " l = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L91_C4", "label": "endtime = time()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [14, 1, 0.9381, 0.0103, 1, 0.09, 0.9, 975, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "endtime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " endtime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "vector": [8, 1, 0.9588, 0.0103, 1, 0.09, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"elapsed:\", endtime - starttime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:If_L95_C0", "label": "if", "type": "if", "loc": [95, 96], "level": 0, "parent": null, "vector": [4, 0, 0.9845, 0.0206, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L96_C4", "label": "test()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_782:If_L95_C0", "vector": [8, 1, 0.9897, 0.0103, 1, 0.49, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Import_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:For_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:For_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:ClassDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Return_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:For_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:For_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:For_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_782:If_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_782:Expr_L96_C4"}] |
#!/usr/bin/env python
from pysqlite2.test import test
test()
| ajibawa-2023/Python-Code-Large/train/row_783 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_783:ImportFrom_L2_C0", "label": "from pysqlite2.test import test", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 0.0, 472, 0, 1, 0, 0, 472, 0, 0], "semantic": {"name": "pysqlite2.test", "arg_names": [], "import_names": ["test"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2.test import test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_783:Expr_L3_C0", "label": "test()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.3333, 0, 0.66, 1.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": "test()"}] | [] |
from pysqlite2 import dbapi2 as sqlite
import os, threading
def getcon():
#con = sqlite.connect("db", isolation_level=None, timeout=5.0)
con = sqlite.connect(":memory:")
cur = con.cursor()
cur.execute("create table test(i, s)")
for i in range(10):
cur.execute("insert into test(i, s) values (?, 'asfd')", (i,))
con.commit()
cur.close()
return con
def reader(what):
con = getcon()
while 1:
cur = con.cursor()
cur.execute("select i, s from test where i % 1000=?", (what,))
res = cur.fetchall()
cur.close()
con.close()
def appender():
con = getcon()
counter = 0
while 1:
cur = con.cursor()
cur.execute("insert into test(i, s) values (?, ?)", (counter, "foosadfasfasfsfafs"))
#cur.execute("insert into test(foo) values (?)", (counter,))
counter += 1
if counter % 100 == 0:
#print "appender committing", counter
con.commit()
cur.close()
con.close()
def updater():
con = getcon()
counter = 0
while 1:
cur = con.cursor()
counter += 1
if counter % 5 == 0:
cur.execute("update test set s='foo' where i % 50=0")
#print "updater committing", counter
con.commit()
cur.close()
con.close()
def deleter():
con = getcon()
counter = 0
while 1:
cur = con.cursor()
counter += 1
if counter % 5 == 0:
#print "deleter committing", counter
cur.execute("delete from test where i % 20=0")
con.commit()
cur.close()
con.close()
threads = []
for i in range(10):
continue
threads.append(threading.Thread(target=lambda: reader(i)))
for i in range(5):
threads.append(threading.Thread(target=appender))
#threads.append(threading.Thread(target=updater))
#threads.append(threading.Thread(target=deleter))
for t in threads:
t.start()
| ajibawa-2023/Python-Code-Large/train/row_784 | 56 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_784:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Import_L2_C0", "label": "os import os, threading", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.0125, 0, 0.66, 0.1, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "label": "getcon", "type": "function", "loc": [4, 13], "level": 0, "parent": null, "vector": [2, 0, 0.1062, 0.125, 0, 0.66, 0.2, 163, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "getcon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getcon():\n #con = sqlite.connect(\"db\", isolation_level=None, timeout=5.0)\n con = sqlite.connect(\":memory:\")\n cur = con.cursor()\n cur.execute(\"create table test(i, s)\")\n for i in range(10):\n cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L6_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [14, 1, 0.075, 0.0125, 1, 0.58, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L7_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [14, 1, 0.0875, 0.0125, 1, 0.58, 0.1667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L8_C4", "label": "execute()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [8, 1, 0.1, 0.0125, 1, 0.58, 0.3333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"create table test(i, s)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:For_L9_C4", "label": "for i", "type": "for", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [6, 1, 0.1187, 0.025, 1, 0.58, 0.5, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(10):\n cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L10_C8", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:For_L9_C4", "vector": [8, 2, 0.125, 0.0125, 2, 0.89, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(i, s) values (?, 'asfd')\", (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L11_C4", "label": "commit()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [8, 1, 0.1375, 0.0125, 1, 0.58, 0.6667, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L12_C4", "label": "close()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [8, 1, 0.15, 0.0125, 1, 0.58, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "vector": [13, 1, 0.1625, 0.0125, 1, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return con"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "label": "reader", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2313, 0.1, 0, 0.66, 0.3, 548, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "reader", "arg_names": ["what"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def reader(what):\n con = getcon()\n while 1:\n cur = con.cursor()\n cur.execute(\"select i, s from test where i % 1000=?\", (what,))\n res = cur.fetchall()\n cur.close()\n con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L16_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "vector": [14, 1, 0.2, 0.0125, 1, 0.99, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "label": "while", "type": "while", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "vector": [5, 1, 0.2375, 0.0625, 1, 0.99, 0.5, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n cur.execute(\"select i, s from test where i % 1000=?\", (what,))\n res = cur.fetchall()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L18_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "vector": [14, 2, 0.225, 0.0125, 2, 0.82, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L19_C8", "label": "execute()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "vector": [8, 2, 0.2375, 0.0125, 2, 0.82, 0.3333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select i, s from test where i % 1000=?\", (what,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L20_C8", "label": "res = fetchall()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "vector": [14, 2, 0.25, 0.0125, 2, 0.82, 0.6667, 413, 3, 0, 0, 0, 133, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " res = cur.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L21_C8", "label": "close()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "vector": [8, 2, 0.2625, 0.0125, 2, 0.82, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L22_C4", "label": "close()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "vector": [8, 1, 0.275, 0.0125, 1, 0.99, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "label": "appender", "type": "function", "loc": [24, 36], "level": 0, "parent": null, "vector": [2, 0, 0.375, 0.1625, 0, 0.66, 0.4, 92, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "appender", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def appender():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))\n #cur.execute(\"insert into test(foo) values (?)\", (counter,))\n counter += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L25_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "vector": [14, 1, 0.3125, 0.0125, 1, 0.65, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L26_C4", "label": "counter =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "vector": [14, 1, 0.325, 0.0125, 1, 0.65, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "label": "while", "type": "while", "loc": [27, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "vector": [5, 1, 0.3875, 0.1125, 1, 0.65, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))\n #cur.execute(\"insert into test(foo) values (?)\", (counter,))\n counter += 1\n if counter % 100 == 0:\n #print \"appender committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L28_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "vector": [14, 2, 0.35, 0.0125, 2, 0.9, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L29_C8", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "vector": [8, 2, 0.3625, 0.0125, 2, 0.9, 0.3333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(i, s) values (?, ?)\", (counter, \"foosadfasfasfsfafs\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:If_L32_C8", "label": "if", "type": "if", "loc": [32, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "vector": [4, 2, 0.4125, 0.0375, 2, 0.9, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 100 == 0:\n #print \"appender committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L34_C12", "label": "commit()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:If_L32_C8", "vector": [8, 3, 0.425, 0.0125, 3, 0.55, 0.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L35_C8", "label": "close()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "vector": [8, 2, 0.4375, 0.0125, 2, 0.9, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L36_C4", "label": "close()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "vector": [8, 1, 0.45, 0.0125, 1, 0.65, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "label": "updater", "type": "function", "loc": [39, 50], "level": 0, "parent": null, "vector": [2, 0, 0.5563, 0.15, 0, 0.66, 0.5, 400, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "updater", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def updater():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L40_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "vector": [14, 1, 0.5, 0.0125, 1, 0.47, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L41_C4", "label": "counter =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "vector": [14, 1, 0.5125, 0.0125, 1, 0.47, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "label": "while", "type": "while", "loc": [42, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "vector": [5, 1, 0.5687, 0.1, 1, 0.47, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")\n #print \"updater committing\", counter\n con.commit()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L43_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "vector": [14, 2, 0.5375, 0.0125, 2, 0.74, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8", "label": "if", "type": "if", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "vector": [4, 2, 0.5813, 0.05, 2, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 5 == 0:\n cur.execute(\"update test set s='foo' where i % 50=0\")\n #print \"updater committing\", counter\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L46_C12", "label": "execute()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8", "vector": [8, 3, 0.575, 0.0125, 3, 0.79, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"update test set s='foo' where i % 50=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L48_C12", "label": "commit()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8", "vector": [8, 3, 0.6, 0.0125, 3, 0.79, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L49_C8", "label": "close()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "vector": [8, 2, 0.6125, 0.0125, 2, 0.74, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L50_C4", "label": "close()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "vector": [8, 1, 0.625, 0.0125, 1, 0.47, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "label": "deleter", "type": "function", "loc": [53, 64], "level": 0, "parent": null, "vector": [2, 0, 0.7312, 0.15, 0, 0.66, 0.6, 628, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "deleter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def deleter():\n con = getcon()\n counter = 0\n while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n #print \"deleter committing\", counter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L54_C4", "label": "con = getcon()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "vector": [14, 1, 0.675, 0.0125, 1, 0.67, 0.0, 761, 3, 0, 0, 0, 163, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "getcon", "annotation": ""}, "snippet": " con = getcon()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L55_C4", "label": "counter =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "vector": [14, 1, 0.6875, 0.0125, 1, 0.67, 0.3333, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "label": "while", "type": "while", "loc": [56, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "vector": [5, 1, 0.7438, 0.1, 1, 0.67, 0.6667, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while 1:\n cur = con.cursor()\n counter += 1\n if counter % 5 == 0:\n #print \"deleter committing\", counter\n cur.execute(\"delete from test where i % 20=0\")\n con.commit()\n cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L57_C8", "label": "cur = cursor()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "vector": [14, 2, 0.7125, 0.0125, 2, 0.54, 0.0, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8", "label": "if", "type": "if", "loc": [59, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "vector": [4, 2, 0.7562, 0.05, 2, 0.54, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if counter % 5 == 0:\n #print \"deleter committing\", counter\n cur.execute(\"delete from test where i % 20=0\")\n con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L61_C12", "label": "execute()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8", "vector": [8, 3, 0.7625, 0.0125, 3, 0.35, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"delete from test where i % 20=0\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L62_C12", "label": "commit()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8", "vector": [8, 3, 0.775, 0.0125, 3, 0.35, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": " con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L63_C8", "label": "close()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "vector": [8, 2, 0.7875, 0.0125, 2, 0.54, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L64_C4", "label": "close()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "vector": [8, 1, 0.8, 0.0125, 1, 0.67, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L66_C0", "label": "threads =", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.825, 0.0125, 0, 0.66, 0.7, 702, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "threads = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:For_L68_C0", "label": "for i", "type": "for", "loc": [68, 70], "level": 0, "parent": null, "vector": [6, 0, 0.8625, 0.0375, 0, 0.66, 0.8, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(10):\n continue\n threads.append(threading.Thread(target=lambda: reader(i)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L70_C4", "label": "append()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:For_L68_C0", "vector": [8, 1, 0.875, 0.0125, 1, 0.78, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " threads.append(threading.Thread(target=lambda: reader(i)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:For_L72_C0", "label": "for i", "type": "for", "loc": [72, 73], "level": 0, "parent": null, "vector": [6, 0, 0.9062, 0.025, 0, 0.66, 0.9, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(5):\n threads.append(threading.Thread(target=appender))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L73_C4", "label": "append()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:For_L72_C0", "vector": [8, 1, 0.9125, 0.0125, 1, 0.45, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " threads.append(threading.Thread(target=appender))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:For_L77_C0", "label": "for t", "type": "for", "loc": [77, 78], "level": 0, "parent": null, "vector": [6, 0, 0.9688, 0.025, 0, 0.66, 1.0, 15, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for t in threads:\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L78_C4", "label": "start()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_784:For_L77_C0", "vector": [8, 1, 0.975, 0.0125, 1, 0.16, 0.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:For_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:For_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:While_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:For_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:For_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_784:For_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_784:Expr_L78_C4"}] |
from __future__ import with_statement
from pysqlite2 import dbapi2 as sqlite3
from datetime import datetime, timedelta
import time
def read_modify_write():
# Open connection and create example schema and data.
# In reality, open a database file instead of an in-memory database.
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
create table test(id integer primary key, data);
insert into test(data) values ('foo');
insert into test(data) values ('bar');
insert into test(data) values ('baz');
""")
# The read part. There are two ways for fetching data using pysqlite.
# 1. "Lazy-reading"
# cur.execute("select ...")
# for row in cur:
# ...
#
# Advantage: Low memory consumption, good for large resultsets, data is
# fetched on demand.
# Disadvantage: Database locked as long as you iterate over cursor.
#
# 2. "Eager reading"
# cur.fetchone() to fetch one row
# cur.fetchall() to fetch all rows
# Advantage: Locks cleared ASAP.
# Disadvantage: fetchall() may build large lists.
cur.execute("select id, data from test where id=?", (2,))
row = cur.fetchone()
# Stupid way to modify the data column.
lst = list(row)
lst[1] = lst[1] + " & more"
# This is the suggested recipe to modify data using pysqlite. We use
# pysqlite's proprietary API to use the connection object as a context
# manager. This is equivalent to the following code:
#
# try:
# cur.execute("...")
# except:
# con.rollback()
# raise
# finally:
# con.commit()
#
# This makes sure locks are cleared - either by commiting or rolling back
# the transaction.
#
# If the rollback happens because of concurrency issues, you just have to
# try again until it succeeds. Much more likely is that the rollback and
# the raised exception happen because of other reasons, though (constraint
# violation, etc.) - don't forget to roll back on errors.
#
# Or use this recipe. It's useful and gets everything done in two lines of
# code.
with con:
cur.execute("update test set data=? where id=?", (lst[1], lst[0]))
def delete_older_than():
# Use detect_types if you want to use date/time types in pysqlite.
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
cur = con.cursor()
# With "DEFAULT current_timestamp" we have SQLite fill the timestamp column
# automatically.
cur.executescript("""
create table test(id integer primary key, data, created timestamp default current_timestamp);
""")
with con:
for i in range(3):
cur.execute("insert into test(data) values ('foo')")
time.sleep(1)
# Delete older than certain interval
# SQLite uses UTC time, so we need to create these timestamps in Python, too.
with con:
delete_before = datetime.utcnow() - timedelta(seconds=2)
cur.execute("delete from test where created < ?", (delete_before,))
def modify_insert():
# Use a unique index and the REPLACE command to have the "insert if not
# there, but modify if it is there" pattern. Race conditions are taken care
# of by transactions.
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
create table test(id integer primary key, name, age);
insert into test(name, age) values ('Adam', 18);
insert into test(name, age) values ('Eve', 21);
create unique index idx_test_data_unique on test(name);
""")
with con:
# Make Adam age 19
cur.execute("replace into test(name, age) values ('Adam', 19)")
# Create new entry
cur.execute("replace into test(name, age) values ('Abel', 3)")
if __name__ == "__main__":
read_modify_write()
delete_older_than()
modify_insert()
| ajibawa-2023/Python-Code-Large/train/row_786 | 32 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_786:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_names": ["with_statement"], "rhs_call_name": "", "annotation": ""}, "snippet": "from __future__ import with_statement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:ImportFrom_L2_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.1429, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:ImportFrom_L3_C0", "label": "from datetime import datetime, timedelta", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0273, 0.0091, 0, 0.66, 0.2857, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "timedelta"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime, timedelta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Import_L4_C0", "label": "time import time", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0091, 0, 0.66, 0.4286, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "label": "read_modify_write", "type": "function", "loc": [6, 64], "level": 0, "parent": null, "vector": [2, 0, 0.3182, 0.5364, 0, 0.66, 0.5714, 917, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "read_modify_write", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_modify_write():\n # Open connection and create example schema and data.\n # In reality, open a database file instead of an in-memory database.\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor()\n cur.executescript(\"\"\"\n create table test(id integer primary key, data);\n insert into test(data) values ('foo');"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L9_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [14, 1, 0.0818, 0.0091, 1, 0.6, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L10_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [14, 1, 0.0909, 0.0091, 1, 0.6, 0.1667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L11_C4", "label": "executescript()", "type": "expression", "loc": [11, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [8, 1, 0.1227, 0.0545, 1, 0.6, 0.3333, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, data);\n insert into test(data) values ('foo');\n insert into test(data) values ('bar');\n insert into test(data) values ('baz');\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L34_C4", "label": "execute()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [8, 1, 0.3091, 0.0091, 1, 0.6, 0.5, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select id, data from test where id=?\", (2,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L35_C4", "label": "row = fetchone()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [14, 1, 0.3182, 0.0091, 1, 0.6, 0.6667, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": " row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L38_C4", "label": "lst = list()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [14, 1, 0.3455, 0.0091, 1, 0.6, 0.8333, 564, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " lst = list(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L39_C4", "label": "assign", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [14, 1, 0.3545, 0.0091, 1, 0.6, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lst[1] = lst[1] + \" & more\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L64_C8", "label": "execute()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "vector": [8, 1, 0.5818, 0.0091, 1, 0.6, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"update test set data=? where id=?\", (lst[1], lst[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "label": "delete_older_than", "type": "function", "loc": [66, 85], "level": 0, "parent": null, "vector": [2, 0, 0.6864, 0.1818, 0, 0.66, 0.7143, 400, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "delete_older_than", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delete_older_than():\n # Use detect_types if you want to use date/time types in pysqlite.\n con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)\n cur = con.cursor()\n\n # With \"DEFAULT current_timestamp\" we have SQLite fill the timestamp column\n # automatically.\n cur.executescript(\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L68_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [14, 1, 0.6182, 0.0091, 1, 0.14, 0.0, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L69_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [14, 1, 0.6273, 0.0091, 1, 0.14, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L73_C4", "label": "executescript()", "type": "expression", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [8, 1, 0.6727, 0.0273, 1, 0.14, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, data, created timestamp default current_timestamp);\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8", "label": "for i", "type": "for", "loc": [77, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [6, 1, 0.7091, 0.0273, 1, 0.14, 0.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(3):\n cur.execute(\"insert into test(data) values ('foo')\")\n time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L78_C12", "label": "execute()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8", "vector": [8, 2, 0.7091, 0.0091, 2, 0.2, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into test(data) values ('foo')\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L79_C12", "label": "sleep()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8", "vector": [8, 2, 0.7182, 0.0091, 2, 0.2, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L84_C8", "label": "delete_before =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [14, 1, 0.7636, 0.0091, 1, 0.14, 0.0, 55, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete_before", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delete_before = datetime.utcnow() - timedelta(seconds=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L85_C8", "label": "execute()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "vector": [8, 1, 0.7727, 0.0091, 1, 0.14, 1.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"delete from test where created < ?\", (delete_before,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "label": "modify_insert", "type": "function", "loc": [87, 105], "level": 0, "parent": null, "vector": [2, 0, 0.8727, 0.1727, 0, 0.66, 0.8571, 298, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "modify_insert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modify_insert():\n # Use a unique index and the REPLACE command to have the \"insert if not\n # there, but modify if it is there\" pattern. Race conditions are taken care\n # of by transactions.\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor()\n cur.executescript(\"\"\"\n create table test(id integer primary key, name, age);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L91_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "vector": [14, 1, 0.8273, 0.0091, 1, 0.26, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L92_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "vector": [14, 1, 0.8364, 0.0091, 1, 0.26, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L93_C4", "label": "executescript()", "type": "expression", "loc": [93, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "vector": [8, 1, 0.8682, 0.0545, 1, 0.26, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": " cur.executescript(\"\"\"\n create table test(id integer primary key, name, age);\n insert into test(name, age) values ('Adam', 18);\n insert into test(name, age) values ('Eve', 21);\n create unique index idx_test_data_unique on test(name);\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L102_C8", "label": "execute()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "vector": [8, 1, 0.9273, 0.0091, 1, 0.26, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"replace into test(name, age) values ('Adam', 19)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L105_C8", "label": "execute()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "vector": [8, 1, 0.9545, 0.0091, 1, 0.26, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"replace into test(name, age) values ('Abel', 3)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "label": "if", "type": "if", "loc": [107, 110], "level": 0, "parent": null, "vector": [4, 0, 0.9864, 0.0364, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n read_modify_write()\n delete_older_than()\n modify_insert()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L108_C4", "label": "read_modify_write()", "type": "expression", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "vector": [8, 1, 0.9818, 0.0091, 1, 0.42, 0.0, 917, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "read_modify_write", "arg_names": [], "import_names": [], "rhs_call_name": "read_modify_write", "annotation": ""}, "snippet": " read_modify_write()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L109_C4", "label": "delete_older_than()", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "vector": [8, 1, 0.9909, 0.0091, 1, 0.42, 0.5, 400, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_older_than", "arg_names": [], "import_names": [], "rhs_call_name": "delete_older_than", "annotation": ""}, "snippet": " delete_older_than()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L110_C4", "label": "modify_insert()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "vector": [8, 1, 1.0, 0.0091, 1, 0.42, 1.0, 298, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "modify_insert", "arg_names": [], "import_names": [], "rhs_call_name": "modify_insert", "annotation": ""}, "snippet": " modify_insert()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_786:If_L107_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_786:Expr_L110_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
Cursor = sqlite3.Cursor
class EagerCursor(Cursor):
def __init__(self, con):
Cursor.__init__(self, con)
self.rows = []
self.pos = 0
def execute(self, *args):
sqlite3.Cursor.execute(self, *args)
self.rows = Cursor.fetchall(self)
self.pos = 0
def fetchone(self):
try:
row = self.rows[self.pos]
self.pos += 1
return row
except IndexError:
return None
def fetchmany(self, num=None):
if num is None:
num = self.arraysize
result = self.rows[self.pos:self.pos+num]
self.pos += num
return result
def fetchall(self):
result = self.rows[self.pos:]
self.pos = len(self.rows)
return result
def test():
con = sqlite3.connect(":memory:")
cur = con.cursor(EagerCursor)
cur.execute("create table test(foo)")
cur.executemany("insert into test(foo) values (?)", [(3,), (4,), (5,)])
cur.execute("select * from test")
print cur.fetchone()
print cur.fetchone()
print cur.fetchone()
print cur.fetchone()
print cur.fetchone()
if __name__ == "__main__":
test()
| ajibawa-2023/Python-Code-Large/train/row_787 | 38 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_787:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L3_C0", "label": "Cursor =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0588, 0.0196, 0, 0.66, 0.25, 647, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Cursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "Cursor = sqlite3.Cursor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "label": "EagerCursor", "type": "class", "loc": [5, 35], "level": 0, "parent": null, "vector": [3, 0, 0.3922, 0.6078, 0, 0.66, 0.5, 971, 0, 5, 0, 0, 647, 0, 4], "semantic": {"name": "EagerCursor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EagerCursor(Cursor):\n def __init__(self, con):\n Cursor.__init__(self, con)\n self.rows = []\n self.pos = 0\n\n def execute(self, *args):\n sqlite3.Cursor.execute(self, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "vector": [2, 1, 0.1471, 0.0784, 1, 0.2, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "con"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, con):\n Cursor.__init__(self, con)\n self.rows = []\n self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L7_C8", "label": "__init__()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "vector": [8, 2, 0.1373, 0.0196, 2, 0.02, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Cursor.__init__(self, con)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L8_C8", "label": "self.rows =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "vector": [14, 2, 0.1569, 0.0196, 2, 0.02, 0.5, 881, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rows = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L9_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "vector": [14, 2, 0.1765, 0.0196, 2, 0.02, 1.0, 283, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "label": "execute", "type": "function", "loc": [11, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "vector": [2, 1, 0.2451, 0.0784, 1, 0.2, 0.25, 569, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def execute(self, *args):\n sqlite3.Cursor.execute(self, *args)\n self.rows = Cursor.fetchall(self)\n self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L12_C8", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "vector": [8, 2, 0.2353, 0.0196, 2, 0.0, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " sqlite3.Cursor.execute(self, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L13_C8", "label": "self.rows = fetchall()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "vector": [14, 2, 0.2549, 0.0196, 2, 0.0, 0.5, 881, 3, 1, 0, 0, 133, 10, 1], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " self.rows = Cursor.fetchall(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L14_C8", "label": "self.pos =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "vector": [14, 2, 0.2745, 0.0196, 2, 0.0, 1.0, 283, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L16_C4", "label": "fetchone", "type": "function", "loc": [16, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "vector": [2, 1, 0.3725, 0.1373, 1, 0.2, 0.5, 561, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "fetchone", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchone(self):\n try:\n row = self.rows[self.pos]\n self.pos += 1\n return row\n except IndexError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "label": "try", "type": "try", "loc": [17, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L16_C4", "vector": [7, 2, 0.3824, 0.1176, 2, 0.33, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n row = self.rows[self.pos]\n self.pos += 1\n return row\n except IndexError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L18_C12", "label": "row =", "type": "assigned_variable", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "vector": [14, 3, 0.3529, 0.0196, 3, 0.94, 0.0, 767, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = self.rows[self.pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L20_C12", "label": "return", "type": "return", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "vector": [13, 3, 0.3922, 0.0196, 3, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L22_C12", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "vector": [13, 3, 0.4314, 0.0196, 3, 0.94, 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_787:FunctionDef_L24_C4", "label": "fetchmany", "type": "function", "loc": [24, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "vector": [2, 1, 0.5294, 0.1373, 1, 0.2, 0.75, 582, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "fetchmany", "arg_names": ["self", "num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchmany(self, num=None):\n if num is None:\n num = self.arraysize\n\n result = self.rows[self.pos:self.pos+num]\n self.pos += num\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:If_L25_C8", "label": "if", "type": "if", "loc": [25, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "vector": [4, 2, 0.5, 0.0392, 2, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if num is None:\n num = self.arraysize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L26_C12", "label": "num =", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:If_L25_C8", "vector": [14, 3, 0.5098, 0.0196, 3, 0.22, 0.0, 328, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num = self.arraysize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L28_C8", "label": "result =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "vector": [14, 2, 0.549, 0.0196, 2, 0.02, 0.5, 51, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self.rows[self.pos:self.pos+num]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "vector": [13, 2, 0.5882, 0.0196, 2, 0.02, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "label": "fetchall", "type": "function", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "vector": [2, 1, 0.6569, 0.0784, 1, 0.2, 1.0, 133, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "fetchall", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetchall(self):\n result = self.rows[self.pos:]\n self.pos = len(self.rows)\n return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L33_C8", "label": "result =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "vector": [14, 2, 0.6471, 0.0196, 2, 0.14, 0.0, 51, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self.rows[self.pos:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L34_C8", "label": "self.pos = len()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "vector": [14, 2, 0.6667, 0.0196, 2, 0.14, 0.5, 283, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.pos", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.pos = len(self.rows)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L35_C8", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "vector": [13, 2, 0.6863, 0.0196, 2, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "label": "test", "type": "function", "loc": [37, 47], "level": 0, "parent": null, "vector": [2, 0, 0.8235, 0.2157, 0, 0.66, 0.75, 224, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n con = sqlite3.connect(\":memory:\")\n cur = con.cursor(EagerCursor)\n cur.execute(\"create table test(foo)\")\n cur.executemany(\"insert into test(foo) values (?)\", [(3,), (4,), (5,)])\n cur.execute(\"select * from test\")\n print(cur.fetchone())\n print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L38_C4", "label": "con = connect()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [14, 1, 0.7451, 0.0196, 1, 0.21, 0.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L39_C4", "label": "cur = cursor()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [14, 1, 0.7647, 0.0196, 1, 0.21, 0.1111, 834, 3, 1, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cur = con.cursor(EagerCursor)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L40_C4", "label": "execute()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.7843, 0.0196, 1, 0.21, 0.2222, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"create table test(foo)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L41_C4", "label": "executemany()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.8039, 0.0196, 1, 0.21, 0.3333, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": " cur.executemany(\"insert into test(foo) values (?)\", [(3,), (4,), (5,)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L42_C4", "label": "execute()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.8235, 0.0196, 1, 0.21, 0.4444, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"select * from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L43_C4", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.8431, 0.0196, 1, 0.21, 0.5556, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L44_C4", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.8627, 0.0196, 1, 0.21, 0.6667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L45_C4", "label": "print()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.8824, 0.0196, 1, 0.21, 0.7778, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L46_C4", "label": "print()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.902, 0.0196, 1, 0.21, 0.8889, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L47_C4", "label": "print()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "vector": [8, 1, 0.9216, 0.0196, 1, 0.21, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cur.fetchone())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:If_L49_C0", "label": "if", "type": "if", "loc": [49, 50], "level": 0, "parent": null, "vector": [4, 0, 0.9706, 0.0392, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L50_C4", "label": "test()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_787:If_L49_C0", "vector": [8, 1, 0.9804, 0.0196, 1, 0.21, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:Try_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Return_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_787:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_787:Expr_L50_C4"}] |
#!/usr/bin/env python
#
# Cross-compile and build pysqlite installers for win32 on Linux or Mac OS X.
#
# The way this works is very ugly, but hey, it *works*! And I didn't have to
# reinvent the wheel using NSIS.
import os
import sys
import urllib
import zipfile
from setup import get_amalgamation
# Cross-compiler
if sys.platform == "darwin":
CC = "/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc"
LIBDIR = "lib.macosx-10.6-i386-2.5"
STRIP = "/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all"
else:
CC = "/usr/bin/i586-mingw32msvc-gcc"
LIBDIR = "lib.linux-i686-2.5"
STRIP = "strip --strip-all"
# Optimization settings
OPT = "-O2"
# pysqlite sources + SQLite amalgamation
SRC = "src/module.c src/connection.c src/cursor.c src/cache.c src/microprotocols.c src/prepare_protocol.c src/statement.c src/util.c src/row.c amalgamation/sqlite3.c"
# You will need to fetch these from
# https://pyext-cross.pysqlite.googlecode.com/hg/
CROSS_TOOLS = "../pysqlite-pyext-cross"
def execute(cmd):
print cmd
return os.system(cmd)
def compile_module(pyver):
VER = pyver.replace(".", "")
INC = "%s/python%s/include" % (CROSS_TOOLS, VER)
vars = locals()
vars.update(globals())
cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\"pysqlite2._sqlite\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars
execute(cmd)
execute("%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd" % vars)
def main():
vars = locals()
vars.update(globals())
get_amalgamation()
for ver in ["2.5", "2.6", "2.7"]:
execute("rm -rf build")
# First, compile the host version. This is just to get the .py files in place.
execute("python2.5 setup.py build")
# Yes, now delete the host extension module. What a waste of time.
os.unlink("build/%(LIBDIR)s/pysqlite2/_sqlite.so" % vars)
# Cross-compile win32 extension module.
compile_module(ver)
# Prepare for target Python version.
libdir_ver = LIBDIR[:-3] + ver
os.rename("build/%(LIBDIR)s" % vars, "build/" + libdir_ver)
# And create the installer!
os.putenv("PYEXT_CROSS", CROSS_TOOLS)
execute("python2.5 setup.py cross_bdist_wininst --skip-build --target-version=" + ver)
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_788 | 41 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_788:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0147, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Import_L9_C0", "label": "sys import sys", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1324, 0.0147, 0, 0.66, 0.0833, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Import_L10_C0", "label": "urllib import urllib", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1471, 0.0147, 0, 0.66, 0.1667, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Import_L11_C0", "label": "zipfile import zipfile", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1618, 0.0147, 0, 0.66, 0.25, 93, 0, 1, 0, 0, 93, 0, 0], "semantic": {"name": "zipfile", "arg_names": [], "import_names": ["zipfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import zipfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:ImportFrom_L13_C0", "label": "from setup import get_amalgamation", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1912, 0.0147, 0, 0.66, 0.3333, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "setup", "arg_names": [], "import_names": ["get_amalgamation"], "rhs_call_name": "", "annotation": ""}, "snippet": "from setup import get_amalgamation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "label": "if", "type": "if", "loc": [16, 23], "level": 0, "parent": null, "vector": [4, 0, 0.2868, 0.1176, 0, 0.66, 0.4167, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if sys.platform == \"darwin\":\n CC = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc\"\n LIBDIR = \"lib.macosx-10.6-i386-2.5\"\n STRIP = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all\"\nelse:\n CC = \"/usr/bin/i586-mingw32msvc-gcc\"\n LIBDIR = \"lib.linux-i686-2.5\"\n STRIP = \"strip --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L17_C4", "label": "CC =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.25, 0.0147, 1, 0.14, 0.0, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CC = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L18_C4", "label": "LIBDIR =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.2647, 0.0147, 1, 0.14, 0.2, 88, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LIBDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LIBDIR = \"lib.macosx-10.6-i386-2.5\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L19_C4", "label": "STRIP =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.2794, 0.0147, 1, 0.14, 0.4, 442, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STRIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " STRIP = \"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L21_C4", "label": "CC =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.3088, 0.0147, 1, 0.14, 0.6, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CC = \"/usr/bin/i586-mingw32msvc-gcc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L22_C4", "label": "LIBDIR =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.3235, 0.0147, 1, 0.14, 0.8, 88, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LIBDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LIBDIR = \"lib.linux-i686-2.5\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L23_C4", "label": "STRIP =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "vector": [14, 1, 0.3382, 0.0147, 1, 0.14, 1.0, 442, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STRIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " STRIP = \"strip --strip-all\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L26_C0", "label": "OPT =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.3824, 0.0147, 0, 0.66, 0.5, 67, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "OPT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OPT = \"-O2\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L29_C0", "label": "SRC =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.4265, 0.0147, 0, 0.66, 0.5833, 454, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SRC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SRC = \"src/module.c src/connection.c src/cursor.c src/cache.c src/microprotocols.c src/prepare_protocol.c src/statement.c src/util.c src/row.c amalgamation/sqlite3.c\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L33_C0", "label": "CROSS_TOOLS =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4853, 0.0147, 0, 0.66, 0.6667, 496, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CROSS_TOOLS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CROSS_TOOLS = \"../pysqlite-pyext-cross\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L35_C0", "label": "execute", "type": "function", "loc": [35, 37], "level": 0, "parent": null, "vector": [2, 0, 0.5294, 0.0441, 0, 0.66, 0.75, 569, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": ["cmd"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def execute(cmd):\n print(cmd)\n return os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L36_C4", "label": "print()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L35_C0", "vector": [8, 1, 0.5294, 0.0147, 1, 0.81, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L35_C0", "vector": [13, 1, 0.5441, 0.0147, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "label": "compile_module", "type": "function", "loc": [39, 46], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.1176, 0, 0.66, 0.8333, 61, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "compile_module", "arg_names": ["pyver"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compile_module(pyver):\n VER = pyver.replace(\".\", \"\")\n INC = \"%s/python%s/include\" % (CROSS_TOOLS, VER)\n vars = locals()\n vars.update(globals())\n cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\\\\"pysqlite2._sqlite\\\\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars\n execute(cmd)\n execute(\"%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L40_C4", "label": "VER = replace()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [14, 1, 0.5882, 0.0147, 1, 0.28, 0.0, 709, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "VER", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " VER = pyver.replace(\".\", \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L41_C4", "label": "INC =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [14, 1, 0.6029, 0.0147, 1, 0.28, 0.1667, 299, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "INC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INC = \"%s/python%s/include\" % (CROSS_TOOLS, VER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L42_C4", "label": "vars = locals()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [14, 1, 0.6176, 0.0147, 1, 0.28, 0.3333, 302, 3, 0, 0, 0, 853, 10, 1], "semantic": {"name": "vars", "arg_names": [], "import_names": [], "rhs_call_name": "locals", "annotation": ""}, "snippet": " vars = locals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L43_C4", "label": "update()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [8, 1, 0.6324, 0.0147, 1, 0.28, 0.5, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " vars.update(globals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L44_C4", "label": "cmd =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [14, 1, 0.6471, 0.0147, 1, 0.28, 0.6667, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = '%(CC)s -mno-cygwin %(OPT)s -mdll -DMODULE_NAME=\\\\\"pysqlite2._sqlite\\\\\" -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -I amalgamation -I %(INC)s -I . %(SRC)s -L %(CROSS_TOOLS)s/python%(VER)s/libs -lpython%(VER)s -o build/%(LIBDIR)s/pysqlite2/_sqlite.pyd' % vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L45_C4", "label": "execute()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [8, 1, 0.6618, 0.0147, 1, 0.28, 0.8333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L46_C4", "label": "execute()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "vector": [8, 1, 0.6765, 0.0147, 1, 0.28, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"%(STRIP)s build/%(LIBDIR)s/pysqlite2/_sqlite.pyd\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "label": "main", "type": "function", "loc": [48, 65], "level": 0, "parent": null, "vector": [2, 0, 0.8309, 0.2647, 0, 0.66, 0.9167, 624, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n vars = locals()\n vars.update(globals())\n get_amalgamation()\n for ver in [\"2.5\", \"2.6\", \"2.7\"]:\n execute(\"rm -rf build\")\n # First, compile the host version. This is just to get the .py files in place.\n execute(\"python2.5 setup.py build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L49_C4", "label": "vars = locals()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "vector": [14, 1, 0.7206, 0.0147, 1, 0.31, 0.0, 302, 3, 0, 0, 0, 853, 10, 1], "semantic": {"name": "vars", "arg_names": [], "import_names": [], "rhs_call_name": "locals", "annotation": ""}, "snippet": " vars = locals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L50_C4", "label": "update()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "vector": [8, 1, 0.7353, 0.0147, 1, 0.31, 0.3333, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " vars.update(globals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L51_C4", "label": "get_amalgamation()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "vector": [8, 1, 0.75, 0.0147, 1, 0.31, 0.6667, 216, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get_amalgamation", "arg_names": [], "import_names": [], "rhs_call_name": "get_amalgamation", "annotation": ""}, "snippet": " get_amalgamation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "label": "for ver", "type": "for", "loc": [52, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "vector": [6, 1, 0.8603, 0.2059, 1, 0.31, 1.0, 648, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "ver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ver in [\"2.5\", \"2.6\", \"2.7\"]:\n execute(\"rm -rf build\")\n # First, compile the host version. This is just to get the .py files in place.\n execute(\"python2.5 setup.py build\")\n # Yes, now delete the host extension module. What a waste of time.\n os.unlink(\"build/%(LIBDIR)s/pysqlite2/_sqlite.so\" % vars)\n # Cross-compile win32 extension module.\n compile_module(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L53_C8", "label": "execute()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.7794, 0.0147, 2, 0.27, 0.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"rm -rf build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L55_C8", "label": "execute()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.8088, 0.0147, 2, 0.27, 0.1429, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"python2.5 setup.py build\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L57_C8", "label": "unlink()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.8382, 0.0147, 2, 0.27, 0.2857, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " os.unlink(\"build/%(LIBDIR)s/pysqlite2/_sqlite.so\" % vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L59_C8", "label": "compile_module()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.8676, 0.0147, 2, 0.27, 0.4286, 61, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "compile_module", "arg_names": [], "import_names": [], "rhs_call_name": "compile_module", "annotation": ""}, "snippet": " compile_module(ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L61_C8", "label": "libdir_ver =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [14, 2, 0.8971, 0.0147, 2, 0.27, 0.5714, 837, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "libdir_ver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " libdir_ver = LIBDIR[:-3] + ver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L62_C8", "label": "rename()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.9118, 0.0147, 2, 0.27, 0.7143, 508, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "rename", "arg_names": [], "import_names": [], "rhs_call_name": "rename", "annotation": ""}, "snippet": " os.rename(\"build/%(LIBDIR)s\" % vars, \"build/\" + libdir_ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L64_C8", "label": "putenv()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.9412, 0.0147, 2, 0.27, 0.8571, 815, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "putenv", "arg_names": [], "import_names": [], "rhs_call_name": "putenv", "annotation": ""}, "snippet": " os.putenv(\"PYEXT_CROSS\", CROSS_TOOLS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L65_C8", "label": "execute()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "vector": [8, 2, 0.9559, 0.0147, 2, 0.27, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " execute(\"python2.5 setup.py cross_bdist_wininst --skip-build --target-version=\" + ver)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:If_L67_C0", "label": "if", "type": "if", "loc": [67, 68], "level": 0, "parent": null, "vector": [4, 0, 0.9926, 0.0294, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L68_C4", "label": "main()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_788:If_L67_C0", "vector": [8, 1, 1.0, 0.0147, 1, 0.48, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:For_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_788:If_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_788:Expr_L68_C4"}] |
# -*- coding: utf-8 -*-
#
# pysqlite documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 22 02:47:54 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# All configuration values have a default value; values that are commented out
# serve to show the default value.
import sys
# If your extensions are in another directory, add it here.
#sys.path.append('some/directory')
# General configuration
# ---------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.addons.*') or your custom ones.
#extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General substitutions.
project = 'pysqlite'
copyright = u'2008-2009, Gerhard Häring'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
version = '2.6'
# The full version, including alpha/beta/rc tags.
release = '2.6.0'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# Options for HTML output
# -----------------------
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
html_style = 'default.css'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['.static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Content template for the index page.
#html_index = ''
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True
# Output file base name for HTML help builder.
htmlhelp_basename = 'pysqlitedoc'
# Options for LaTeX output
# ------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = []
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
| ajibawa-2023/Python-Code-Large/train/row_789 | 14 | 132 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_789:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1061, 0.0076, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L27_C0", "label": "templates_path =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.2045, 0.0076, 0, 0.66, 0.0769, 518, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "templates_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "templates_path = ['.templates']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L30_C0", "label": "source_suffix =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.2273, 0.0076, 0, 0.66, 0.1538, 462, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "source_suffix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "source_suffix = '.rst'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L33_C0", "label": "master_doc =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0076, 0, 0.66, 0.2308, 389, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "master_doc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "master_doc = 'index'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L36_C0", "label": "project =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0076, 0, 0.66, 0.3077, 841, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "project", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "project = 'pysqlite'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L37_C0", "label": "copyright =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.2803, 0.0076, 0, 0.66, 0.3846, 928, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "copyright", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "copyright = u'2008-2009, Gerhard H\u00e4ring'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L43_C0", "label": "version =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.3258, 0.0076, 0, 0.66, 0.4615, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = '2.6'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L45_C0", "label": "release =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.3409, 0.0076, 0, 0.66, 0.5385, 784, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "release = '2.6.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L51_C0", "label": "today_fmt =", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.3864, 0.0076, 0, 0.66, 0.6154, 820, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "today_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "today_fmt = '%B %d, %Y'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L68_C0", "label": "pygments_style =", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.5152, 0.0076, 0, 0.66, 0.6923, 745, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pygments_style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pygments_style = 'sphinx'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L77_C0", "label": "html_style =", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0076, 0, 0.66, 0.7692, 262, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html_style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_style = 'default.css'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L82_C0", "label": "html_static_path =", "type": "assigned_variable", "loc": [82, 82], "level": 0, "parent": null, "vector": [14, 0, 0.6212, 0.0076, 0, 0.66, 0.8462, 979, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "html_static_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_static_path = ['.static']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L86_C0", "label": "html_last_updated_fmt =", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.6515, 0.0076, 0, 0.66, 0.9231, 587, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html_last_updated_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "html_last_updated_fmt = '%b %d, %Y'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_789:Assign_L109_C0", "label": "htmlhelp_basename =", "type": "assigned_variable", "loc": [109, 109], "level": 0, "parent": null, "vector": [14, 0, 0.8258, 0.0076, 0, 0.66, 1.0, 14, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "htmlhelp_basename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "htmlhelp_basename = 'pysqlitedoc'"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
FIELD_MAX_WIDTH = 20
TABLE_NAME = 'people'
SELECT = 'select * from %s order by age, name_last' % TABLE_NAME
con = sqlite3.connect("mydb")
cur = con.cursor()
cur.execute(SELECT)
# Print a header.
for fieldDesc in cur.description:
print fieldDesc[0].ljust(FIELD_MAX_WIDTH) ,
print # Finish the header with a newline.
print '-' * 78
# For each row, print the value of each field left-justified within
# the maximum possible width of that field.
fieldIndices = range(len(cur.description))
for row in cur:
for fieldIndex in fieldIndices:
fieldValue = str(row[fieldIndex])
print fieldValue.ljust(FIELD_MAX_WIDTH) ,
print # Finish the row with a newline.
| ajibawa-2023/Python-Code-Large/train/row_790 | 1 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_790:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
def progress():
print "Query still executing. Please wait ..."
con = sqlite3.connect(":memory:")
con.execute("create table test(x)")
# Let's create some data
con.executemany("insert into test(x) values (?)", [(x,) for x in xrange(300)])
# A progress handler, executed every 10 million opcodes
con.set_progress_handler(progress, 10000000)
# A particularly long-running query
killer_stament = """
select count(*) from (
select t1.x from test t1, test t2, test t3
)
"""
con.execute(killer_stament)
print "-" * 50
# Clear the progress handler
con.set_progress_handler(None, 0)
con.execute(killer_stament)
| ajibawa-2023/Python-Code-Large/train/row_791 | 12 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_791:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:FunctionDef_L3_C0", "label": "progress", "type": "function", "loc": [3, 4], "level": 0, "parent": null, "vector": [2, 0, 0.1207, 0.069, 0, 0.66, 0.1, 82, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def progress():\n print(\"Query still executing. Please wait ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L4_C4", "label": "print()", "type": "expression", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_791:FunctionDef_L3_C0", "vector": [8, 1, 0.1379, 0.0345, 1, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Query still executing. Please wait ...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Assign_L6_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.2069, 0.0345, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.2414, 0.0345, 0, 0.66, 0.3, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table test(x)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L10_C0", "label": "executemany()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.3448, 0.0345, 0, 0.66, 0.4, 175, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "con.executemany(\"insert into test(x) values (?)\", [(x,) for x in xrange(300)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L13_C0", "label": "set_progress_handler()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.4483, 0.0345, 0, 0.66, 0.5, 301, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_progress_handler", "arg_names": [], "import_names": [], "rhs_call_name": "set_progress_handler", "annotation": ""}, "snippet": "con.set_progress_handler(progress, 10000000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Assign_L16_C0", "label": "killer_stament =", "type": "assigned_variable", "loc": [16, 20], "level": 0, "parent": null, "vector": [14, 0, 0.6207, 0.1724, 0, 0.66, 0.6, 804, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "killer_stament", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "killer_stament = \"\"\"\n select count(*) from (\n select t1.x from test t1, test t2, test t3\n )\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L22_C0", "label": "execute()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.7586, 0.0345, 0, 0.66, 0.7, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(killer_stament)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L23_C0", "label": "print()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.7931, 0.0345, 0, 0.66, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"-\" * 50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L26_C0", "label": "set_progress_handler()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.8966, 0.0345, 0, 0.66, 0.9, 301, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_progress_handler", "arg_names": [], "import_names": [], "rhs_call_name": "set_progress_handler", "annotation": ""}, "snippet": "con.set_progress_handler(None, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L28_C0", "label": "execute()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.9655, 0.0345, 0, 0.66, 1.0, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(killer_stament)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_791:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_791:Expr_L4_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
SELECT = "select name_last, age from people order by age, name_last"
# 1. Iterate over the rows available from the cursor, unpacking the
# resulting sequences to yield their elements (name_last, age):
cur.execute(SELECT)
for (name_last, age) in cur:
print '%s is %d years old.' % (name_last, age)
# 2. Equivalently:
cur.execute(SELECT)
for row in cur:
print '%s is %d years old.' % (row[0], row[1])
| ajibawa-2023/Python-Code-Large/train/row_792 | 10 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_792:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1765, 0.0588, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2941, 0.0588, 0, 0.66, 0.2857, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Assign_L6_C0", "label": "SELECT =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.3529, 0.0588, 0, 0.66, 0.4286, 736, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SELECT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SELECT = \"select name_last, age from people order by age, name_last\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.5882, 0.0588, 0, 0.66, 0.5714, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(SELECT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:For_L11_C0", "label": "for name_last, age", "type": "for", "loc": [11, 12], "level": 0, "parent": null, "vector": [6, 0, 0.6765, 0.1176, 0, 0.66, 0.7143, 234, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name_last, age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for (name_last, age) in cur:\n print('%s is %d years old.' % (name_last, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L12_C4", "label": "print()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_792:For_L11_C0", "vector": [8, 1, 0.7059, 0.0588, 1, 0.08, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is %d years old.' % (name_last, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L15_C0", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.8824, 0.0588, 0, 0.66, 0.8571, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(SELECT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:For_L16_C0", "label": "for row", "type": "for", "loc": [16, 17], "level": 0, "parent": null, "vector": [6, 0, 0.9706, 0.1176, 0, 0.66, 1.0, 767, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n print('%s is %d years old.' % (row[0], row[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_792:For_L16_C0", "vector": [8, 1, 1.0, 0.0588, 1, 0.65, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s is %d years old.' % (row[0], row[1]))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_792:For_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_792:For_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_792:Expr_L17_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
# Create a connection to the database file "mydb":
con = sqlite3.connect("mydb")
# Get a Cursor object that operates in the context of Connection con:
cur = con.cursor()
# Execute the SELECT statement:
cur.execute("select * from people order by age")
# Retrieve all rows as a sequence and print that sequence:
print cur.fetchall()
| ajibawa-2023/Python-Code-Large/train/row_793 | 5 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_793:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_793:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3077, 0.0769, 0, 0.66, 0.25, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_793:Assign_L7_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5385, 0.0769, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_793:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.7692, 0.0769, 0, 0.66, 0.75, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select * from people order by age\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_793:Expr_L13_C0", "label": "print()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0769, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
| ajibawa-2023/Python-Code-Large/train/row_794 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_794:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_794:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.3333, 0, 0.66, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
class MySum:
def __init__(self):
self.count = 0
def step(self, value):
self.count += value
def finalize(self):
return self.count
con = sqlite3.connect(":memory:")
con.create_aggregate("mysum", 1, MySum)
cur = con.cursor()
cur.execute("create table test(i)")
cur.execute("insert into test(i) values (1)")
cur.execute("insert into test(i) values (2)")
cur.execute("select mysum(i) from test")
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_795 | 15 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_795:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "label": "MySum", "type": "class", "loc": [3, 11], "level": 0, "parent": null, "vector": [3, 0, 0.35, 0.45, 0, 0.66, 0.1111, 865, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "MySum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MySum:\n def __init__(self):\n self.count = 0\n\n def step(self, value):\n self.count += value\n\n def finalize(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "vector": [2, 1, 0.225, 0.1, 1, 0.21, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Assign_L5_C8", "label": "self.count =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4", "vector": [14, 2, 0.25, 0.05, 2, 0.83, 0.0, 340, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L7_C4", "label": "step", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "vector": [2, 1, 0.375, 0.1, 1, 0.21, 0.5, 880, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "step", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def step(self, value):\n self.count += value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L10_C4", "label": "finalize", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "vector": [2, 1, 0.525, 0.1, 1, 0.21, 1.0, 716, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "finalize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def finalize(self):\n return self.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L10_C4", "vector": [13, 2, 0.55, 0.05, 2, 0.35, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Assign_L13_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.65, 0.05, 0, 0.66, 0.2222, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L14_C0", "label": "create_aggregate()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.05, 0, 0.66, 0.3333, 843, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_aggregate", "arg_names": [], "import_names": [], "rhs_call_name": "create_aggregate", "annotation": ""}, "snippet": "con.create_aggregate(\"mysum\", 1, MySum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Assign_L15_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.05, 0, 0.66, 0.4444, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L16_C0", "label": "execute()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.05, 0, 0.66, 0.5556, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(i)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L17_C0", "label": "execute()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.85, 0.05, 0, 0.66, 0.6667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(i) values (1)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.9, 0.05, 0, 0.66, 0.7778, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(i) values (2)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L19_C0", "label": "execute()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.95, 0.05, 0, 0.66, 0.8889, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select mysum(i) from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_795:Expr_L20_C0", "label": "print()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.05, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_795:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_795:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_795:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_795:Return_L11_C8"}] |
# A minimal SQLite shell for experiments
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
con.isolation_level = None
cur = con.cursor()
buffer = ""
print "Enter your SQL commands to execute in SQLite."
print "Enter a blank line to exit."
while True:
line = raw_input()
if line == "":
break
buffer += line
if sqlite3.complete_statement(buffer):
try:
buffer = buffer.strip()
cur.execute(buffer)
if buffer.lstrip().upper().startswith("SELECT"):
print cur.fetchall()
except sqlite3.Error, e:
print "An error occurred:", e.args[0]
buffer = ""
con.close()
| ajibawa-2023/Python-Code-Large/train/row_796 | 1 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_796:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
con = sqlite3.connect(":memory:")
con.row_factory = dict_factory
cur = con.cursor()
cur.execute("select 1 as a")
print cur.fetchone()["a"]
| ajibawa-2023/Python-Code-Large/train/row_797 | 11 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_797:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "label": "dict_factory", "type": "function", "loc": [3, 7], "level": 0, "parent": null, "vector": [2, 0, 0.3846, 0.3846, 0, 0.66, 0.1667, 131, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "dict_factory", "arg_names": ["cursor", "row"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dict_factory(cursor, row):\n d = {}\n for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L4_C4", "label": "d =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "vector": [14, 1, 0.3077, 0.0769, 1, 0.62, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:For_L5_C4", "label": "for idx, col", "type": "for", "loc": [5, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "vector": [6, 1, 0.4231, 0.1538, 1, 0.62, 0.5, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, col in enumerate(cursor.description):\n d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L6_C8", "label": "assign", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_797:For_L5_C4", "vector": [14, 2, 0.4615, 0.0769, 2, 0.91, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[col[0]] = row[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Return_L7_C4", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "vector": [13, 1, 0.5385, 0.0769, 1, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L9_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6923, 0.0769, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L10_C0", "label": "con.row_factory =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.7692, 0.0769, 0, 0.66, 0.5, 721, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.row_factory = dict_factory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L11_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.8462, 0.0769, 0, 0.66, 0.6667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.9231, 0.0769, 0, 0.66, 0.8333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select 1 as a\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_797:Expr_L13_C0", "label": "print()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0769, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[\"a\"])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_797:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_797:For_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_797:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_797:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_797:Return_L7_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
import datetime
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
cur = con.cursor()
cur.execute("create table test(d date, ts timestamp)")
today = datetime.date.today()
now = datetime.datetime.now()
cur.execute("insert into test(d, ts) values (?, ?)", (today, now))
cur.execute("select d, ts from test")
row = cur.fetchone()
print today, "=>", row[0], type(row[0])
print now, "=>", row[1], type(row[1])
cur.execute('select current_date as "d [date]", current_timestamp as "ts [timestamp]"')
row = cur.fetchone()
print "current_date", row[0], type(row[0])
print "current_timestamp", row[1], type(row[1])
| ajibawa-2023/Python-Code-Large/train/row_798 | 16 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_798:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Import_L2_C0", "label": "datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.05, 0, 0.66, 0.0667, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2, 0.05, 0, 0.66, 0.1333, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.05, 0, 0.66, 0.2, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L6_C0", "label": "execute()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.3, 0.05, 0, 0.66, 0.2667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(d date, ts timestamp)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L8_C0", "label": "today = today()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.4, 0.05, 0, 0.66, 0.3333, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": "today = datetime.date.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L9_C0", "label": "now = now()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.45, 0.05, 0, 0.66, 0.4, 894, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": "now = datetime.datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L11_C0", "label": "execute()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.55, 0.05, 0, 0.66, 0.4667, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(d, ts) values (?, ?)\", (today, now))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.6, 0.05, 0, 0.66, 0.5333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select d, ts from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L13_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.65, 0.05, 0, 0.66, 0.6, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L14_C0", "label": "print()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.7, 0.05, 0, 0.66, 0.6667, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(today, \"=>\", row[0], type(row[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.05, 0, 0.66, 0.7333, 535, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(now, \"=>\", row[1], type(row[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L17_C0", "label": "execute()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.85, 0.05, 0, 0.66, 0.8, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select current_date as \"d [date]\", current_timestamp as \"ts [timestamp]\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Assign_L18_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.9, 0.05, 0, 0.66, 0.8667, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L19_C0", "label": "print()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.95, 0.05, 0, 0.66, 0.9333, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"current_date\", row[0], type(row[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_798:Expr_L20_C0", "label": "print()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.05, 0, 0.66, 1.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"current_timestamp\", row[1], type(row[1]))"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
def authorizer_callback(action, arg1, arg2, dbname, source):
if action != sqlite3.SQLITE_SELECT:
return sqlite3.SQLITE_DENY
if arg1 == "private_table":
return sqlite3.SQLITE_DENY
return sqlite3.SQLITE_OK
con = sqlite3.connect(":memory:")
con.executescript("""
create table public_table(c1, c2);
create table private_table(c1, c2);
""")
con.set_authorizer(authorizer_callback)
try:
con.execute("select * from private_table")
except sqlite3.DatabaseError, e:
print "SELECT FROM private_table =>", e.args[0] # access ... prohibited
try:
con.execute("insert into public_table(c1, c2) values (1, 2)")
except sqlite3.DatabaseError, e:
print "DML command =>", e.args[0] # access ... prohibited
| ajibawa-2023/Python-Code-Large/train/row_799 | 7 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_799:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "label": "authorizer_callback", "type": "function", "loc": [3, 8], "level": 0, "parent": null, "vector": [2, 0, 0.6111, 0.6667, 0, 0.66, 1.0, 423, 0, 5, 1, 0, 0, 0, 0], "semantic": {"name": "authorizer_callback", "arg_names": ["action", "arg1", "arg2", "dbname", "source"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def authorizer_callback(action, arg1, arg2, dbname, source):\n if action != sqlite3.SQLITE_SELECT:\n return sqlite3.SQLITE_DENY\n if arg1 == \"private_table\":\n return sqlite3.SQLITE_DENY\n return sqlite3.SQLITE_OK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4", "label": "if", "type": "if", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "vector": [4, 1, 0.5, 0.2222, 1, 0.96, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if action != sqlite3.SQLITE_SELECT:\n return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L5_C8", "label": "return", "type": "return", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4", "vector": [13, 2, 0.5556, 0.1111, 2, 0.87, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:If_L6_C4", "label": "if", "type": "if", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "vector": [4, 1, 0.7222, 0.2222, 1, 0.96, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if arg1 == \"private_table\":\n return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L7_C8", "label": "return", "type": "return", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_799:If_L6_C4", "vector": [13, 2, 0.7778, 0.1111, 2, 0.73, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_DENY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L8_C4", "label": "return", "type": "return", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "vector": [13, 1, 0.8889, 0.1111, 1, 0.96, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.SQLITE_OK"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_799:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:If_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_799:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_799:Return_L8_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
# The shared cache is only available in SQLite versions 3.3.3 or later
# See the SQLite documentaton for details.
sqlite3.enable_shared_cache(True)
| ajibawa-2023/Python-Code-Large/train/row_800 | 2 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_800:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_800:Expr_L6_C0", "label": "enable_shared_cache()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.1667, 0, 0.66, 1.0, 965, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_shared_cache", "arg_names": [], "import_names": [], "rhs_call_name": "enable_shared_cache", "annotation": ""}, "snippet": "sqlite3.enable_shared_cache(True)"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
| ajibawa-2023/Python-Code-Large/train/row_801 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_801:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_801:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.3333, 0, 0.66, 1.0, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=? and age=?", (who, age))
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_802 | 7 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_802:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0909, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4545, 0.0909, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0909, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.7273, 0.0909, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=? and age=?\", (who, age))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_802:Expr_L11_C0", "label": "print()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}] | [] |
from __future__ import with_statement
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
con.execute("create table person (id integer primary key, firstname varchar unique)")
# Successful, con.commit() is called automatically afterwards
with con:
con.execute("insert into person(firstname) values (?)", ("Joe",))
# con.rollback() is called after the with block finishes with an exception, the
# exception is still raised and must be catched
try:
with con:
con.execute("insert into person(firstname) values (?)", ("Joe",))
except sqlite3.IntegrityError:
print "couldn't add Joe twice"
| ajibawa-2023/Python-Code-Large/train/row_803 | 8 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_803:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_names": ["with_statement"], "rhs_call_name": "", "annotation": ""}, "snippet": "from __future__ import with_statement"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:ImportFrom_L2_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.25, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2105, 0.0526, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L5_C0", "label": "execute()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2632, 0.0526, 0, 0.66, 0.75, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person (id integer primary key, firstname varchar unique)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L9_C4", "label": "execute()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.4737, 0.0526, 0, 0.66, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "label": "try", "type": "try", "loc": [13, 17], "level": 0, "parent": null, "vector": [7, 0, 0.7895, 0.2632, 0, 0.66, 1.25, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n with con:\n con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))\nexcept sqlite3.IntegrityError:\n print(\"couldn't add Joe twice\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L15_C8", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "vector": [8, 1, 0.7895, 0.0526, 1, 0.2, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " con.execute(\"insert into person(firstname) values (?)\", (\"Joe\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "vector": [8, 1, 0.8947, 0.0526, 1, 0.2, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"couldn't add Joe twice\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_803:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_803:Expr_L17_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
import md5
def md5sum(t):
return md5.md5(t).hexdigest()
con = sqlite3.connect(":memory:")
con.create_function("md5", 1, md5sum)
cur = con.cursor()
cur.execute("select md5(?)", ("foo",))
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_804 | 9 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_804:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Import_L2_C0", "label": "md5 import md5", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.1429, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "md5", "arg_names": [], "import_names": ["md5"], "rhs_call_name": "", "annotation": ""}, "snippet": "import md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:FunctionDef_L4_C0", "label": "md5sum", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.4091, 0.1818, 0, 0.66, 0.2857, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "md5sum", "arg_names": ["t"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def md5sum(t):\n return md5.md5(t).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_804:FunctionDef_L4_C0", "vector": [13, 1, 0.4545, 0.0909, 1, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return md5.md5(t).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Assign_L7_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0909, 0, 0.66, 0.4286, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Expr_L8_C0", "label": "create_function()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.7273, 0.0909, 0, 0.66, 0.5714, 567, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "create_function", "arg_names": [], "import_names": [], "rhs_call_name": "create_function", "annotation": ""}, "snippet": "con.create_function(\"md5\", 1, md5sum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.0909, 0, 0.66, 0.7143, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.9091, 0.0909, 0, 0.66, 0.8571, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select md5(?)\", (\"foo\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_804:Expr_L11_C0", "label": "print()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0909, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_804:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_804:Return_L5_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
con.row_factory = sqlite3.Row
cur = con.cursor()
cur.execute("select name_last, age from people")
for row in cur:
assert row[0] == row["name_last"]
assert row["name_last"] == row["nAmE_lAsT"]
assert row[1] == row["age"]
assert row[1] == row["AgE"]
| ajibawa-2023/Python-Code-Large/train/row_805 | 6 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_805:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_805:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_805:Assign_L4_C0", "label": "con.row_factory =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.4, 721, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.row_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.row_factory = sqlite3.Row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_805:Assign_L6_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0833, 0, 0.66, 0.6, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_805:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5833, 0.0833, 0, 0.66, 0.8, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_805:For_L8_C0", "label": "for row", "type": "for", "loc": [8, 12], "level": 0, "parent": null, "vector": [6, 0, 0.8333, 0.4167, 0, 0.66, 1.0, 767, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n assert row[0] == row[\"name_last\"]\n assert row[\"name_last\"] == row[\"nAmE_lAsT\"]\n assert row[1] == row[\"age\"]\n assert row[1] == row[\"AgE\"]"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def adapt_point(point):
return "%f;%f" % (point.x, point.y)
sqlite3.register_adapter(Point, adapt_point)
con = sqlite3.connect(":memory:")
cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute("select ?", (p,))
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_806 | 12 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_806:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 5], "level": 0, "parent": null, "vector": [3, 0, 0.2353, 0.1765, 0, 0.66, 0.125, 652, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_806:ClassDef_L3_C0", "vector": [2, 1, 0.2647, 0.1176, 1, 0.01, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4", "vector": [14, 2, 0.2941, 0.0588, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L7_C0", "label": "adapt_point", "type": "function", "loc": [7, 8], "level": 0, "parent": null, "vector": [2, 0, 0.4412, 0.1176, 0, 0.66, 0.25, 704, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "adapt_point", "arg_names": ["point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_point(point):\n return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Return_L8_C4", "label": "return", "type": "return", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L7_C0", "vector": [13, 1, 0.4706, 0.0588, 1, 0.31, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Expr_L10_C0", "label": "register_adapter()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.5882, 0.0588, 0, 0.66, 0.375, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(Point, adapt_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.7059, 0.0588, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L13_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.7647, 0.0588, 0, 0.66, 0.625, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L15_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.8824, 0.0588, 0, 0.66, 0.75, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Expr_L16_C0", "label": "execute()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.9412, 0.0588, 0, 0.66, 0.875, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_806:Expr_L17_C0", "label": "print()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0588, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_806:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_806:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_806:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_806:Return_L8_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
# Create the table
con.execute("create table person(lastname, firstname)")
AUSTRIA = u"\xd6sterreich"
# by default, rows are returned as Unicode
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert row[0] == AUSTRIA
# but we can make pysqlite always return bytestrings ...
con.text_factory = str
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert type(row[0]) == str
# the bytestrings will be encoded in UTF-8, unless you stored garbage in the
# database ...
assert row[0] == AUSTRIA.encode("utf-8")
# we can also implement a custom text_factory ...
# here we implement one that will ignore Unicode characters that cannot be
# decoded from UTF-8
con.text_factory = lambda x: unicode(x, "utf-8", "ignore")
cur.execute("select ?", ("this is latin1 and would normally create errors" + u"\xe4\xf6\xfc".encode("latin1"),))
row = cur.fetchone()
assert type(row[0]) == unicode
# pysqlite offers a builtin optimized text_factory that will return bytestring
# objects, if the data is in ASCII only, and otherwise return unicode objects
con.text_factory = sqlite3.OptimizedUnicode
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert type(row[0]) == unicode
cur.execute("select ?", ("Germany",))
row = cur.fetchone()
assert type(row[0]) == str
| ajibawa-2023/Python-Code-Large/train/row_807 | 18 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_807:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0238, 0, 0.66, 0.0588, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L4_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0952, 0.0238, 0, 0.66, 0.1176, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L7_C0", "label": "execute()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.0238, 0, 0.66, 0.1765, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person(lastname, firstname)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L9_C0", "label": "AUSTRIA =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.2143, 0.0238, 0, 0.66, 0.2353, 918, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUSTRIA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUSTRIA = u\"\\xd6sterreich\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.2857, 0.0238, 0, 0.66, 0.2941, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L13_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3095, 0.0238, 0, 0.66, 0.3529, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L17_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.4048, 0.0238, 0, 0.66, 0.4706, 979, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4286, 0.0238, 0, 0.66, 0.5294, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L19_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.4524, 0.0238, 0, 0.66, 0.5882, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L28_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0238, 0, 0.66, 0.7647, 979, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = lambda x: unicode(x, \"utf-8\", \"ignore\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L29_C0", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.6905, 0.0238, 0, 0.66, 0.8235, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (\"this is latin1 and would normally create errors\" + u\"\\xe4\\xf6\\xfc\".encode(\"latin1\"),))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L30_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.0238, 0, 0.66, 0.8824, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L35_C0", "label": "con.text_factory =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0238, 0, 0.66, 1.0, 979, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "con.text_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "con.text_factory = sqlite3.OptimizedUnicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L36_C0", "label": "execute()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 0.8571, 0.0238, 0, 0.66, 1.0588, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (AUSTRIA,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L37_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.881, 0.0238, 0, 0.66, 1.1176, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Expr_L40_C0", "label": "execute()", "type": "expression", "loc": [40, 40], "level": 0, "parent": null, "vector": [8, 0, 0.9524, 0.0238, 0, 0.66, 1.2353, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (\"Germany\",))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_807:Assign_L41_C0", "label": "row = fetchone()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.9762, 0.0238, 0, 0.66, 1.2941, 767, 3, 0, 0, 0, 561, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "fetchone", "annotation": ""}, "snippet": "row = cur.fetchone()"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
class CountCursorsConnection(sqlite3.Connection):
def __init__(self, *args, **kwargs):
sqlite3.Connection.__init__(self, *args, **kwargs)
self.numcursors = 0
def cursor(self, *args, **kwargs):
self.numcursors += 1
return sqlite3.Connection.cursor(self, *args, **kwargs)
con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
cur1 = con.cursor()
cur2 = con.cursor()
print con.numcursors
| ajibawa-2023/Python-Code-Large/train/row_808 | 11 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_808:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "label": "CountCursorsConnection", "type": "class", "loc": [3, 10], "level": 0, "parent": null, "vector": [3, 0, 0.4333, 0.5333, 0, 0.66, 0.2, 293, 0, 2, 0, 0, 809, 0, 2], "semantic": {"name": "CountCursorsConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CountCursorsConnection(sqlite3.Connection):\n def __init__(self, *args, **kwargs):\n sqlite3.Connection.__init__(self, *args, **kwargs)\n self.numcursors = 0\n\n def cursor(self, *args, **kwargs):\n self.numcursors += 1\n return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "vector": [2, 1, 0.3333, 0.2, 1, 0.0, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n sqlite3.Connection.__init__(self, *args, **kwargs)\n self.numcursors = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Expr_L5_C8", "label": "__init__()", "type": "expression", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "vector": [8, 2, 0.3333, 0.0667, 2, 0.69, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " sqlite3.Connection.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Assign_L6_C8", "label": "self.numcursors =", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "vector": [14, 2, 0.4, 0.0667, 2, 0.69, 1.0, 848, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.numcursors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.numcursors = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L8_C4", "label": "cursor", "type": "function", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "vector": [2, 1, 0.6, 0.2, 1, 0.0, 1.0, 231, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "cursor", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cursor(self, *args, **kwargs):\n self.numcursors += 1\n return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Return_L10_C8", "label": "return", "type": "return", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L8_C4", "vector": [13, 2, 0.6667, 0.0667, 2, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sqlite3.Connection.cursor(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.8, 0.0667, 0, 0.66, 0.4, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", factory=CountCursorsConnection)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Assign_L13_C0", "label": "cur1 = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.8667, 0.0667, 0, 0.66, 0.6, 937, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur1", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur1 = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Assign_L14_C0", "label": "cur2 = cursor()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.9333, 0.0667, 0, 0.66, 0.8, 610, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur2", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur2 = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_808:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(con.numcursors)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_808:Expr_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_808:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_808:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_808:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_808:Return_L10_C8"}] |
from pysqlite2 import dbapi2 as sqlite3
def collate_reverse(string1, string2):
return -cmp(string1, string2)
con = sqlite3.connect(":memory:")
con.create_collation("reverse", collate_reverse)
cur = con.cursor()
cur.execute("create table test(x)")
cur.executemany("insert into test(x) values (?)", [("a",), ("b",)])
cur.execute("select x from test order by x collate reverse")
for row in cur:
print row
con.close()
| ajibawa-2023/Python-Code-Large/train/row_809 | 12 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_809:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:FunctionDef_L3_C0", "label": "collate_reverse", "type": "function", "loc": [3, 4], "level": 0, "parent": null, "vector": [2, 0, 0.2333, 0.1333, 0, 0.66, 0.1111, 722, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "collate_reverse", "arg_names": ["string1", "string2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def collate_reverse(string1, string2):\n return -cmp(string1, string2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Return_L4_C4", "label": "return", "type": "return", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_809:FunctionDef_L3_C0", "vector": [13, 1, 0.2667, 0.0667, 1, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -cmp(string1, string2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Assign_L6_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.4, 0.0667, 0, 0.66, 0.2222, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L7_C0", "label": "create_collation()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.4667, 0.0667, 0, 0.66, 0.3333, 644, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_collation", "arg_names": [], "import_names": [], "rhs_call_name": "create_collation", "annotation": ""}, "snippet": "con.create_collation(\"reverse\", collate_reverse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0667, 0, 0.66, 0.4444, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0667, 0, 0.66, 0.5556, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(x)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L11_C0", "label": "executemany()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.7333, 0.0667, 0, 0.66, 0.6667, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into test(x) values (?)\", [(\"a\",), (\"b\",)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L12_C0", "label": "execute()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0667, 0, 0.66, 0.7778, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select x from test order by x collate reverse\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:For_L13_C0", "label": "for row", "type": "for", "loc": [13, 14], "level": 0, "parent": null, "vector": [6, 0, 0.9, 0.1333, 0, 0.66, 0.8889, 767, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in cur:\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L14_C4", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_809:For_L13_C0", "vector": [8, 1, 0.9333, 0.0667, 1, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L15_C0", "label": "close()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_809:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_809:Return_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_809:For_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_809:Expr_L14_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
create table person(
firstname,
lastname,
age
);
create table book(
title,
author,
published
);
insert into book(title, author, published)
values (
'Dirk Gently''s Holistic Detective Agency',
'Douglas Adams',
1987
);
""")
| ajibawa-2023/Python-Code-Large/train/row_810 | 4 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_810:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_810:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0417, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_810:Assign_L4_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.1667, 0.0417, 0, 0.66, 0.6667, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_810:Expr_L5_C0", "label": "executescript()", "type": "expression", "loc": [5, 24], "level": 0, "parent": null, "vector": [8, 0, 0.6042, 0.8333, 0, 0.66, 1.0, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": "cur.executescript(\"\"\"\n create table person(\n firstname,\n lastname,\n age\n );\n\n create table book("}] | [] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
# enable extension loading
con.enable_load_extension(True)
# Load the fulltext search extension
con.execute("select load_extension('./fts3.so')")
# alternatively you can load the extension using an API call:
# con.load_extension("./fts3.so")
# disable extension laoding again
con.enable_load_extension(False)
# example from SQLite wiki
con.execute("create virtual table recipe using fts3(name, ingredients)")
con.executescript("""
insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');
insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');
insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');
insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');
""")
for row in con.execute("select rowid, name, ingredients from recipe where name match 'pie'"):
print row
| ajibawa-2023/Python-Code-Large/train/row_811 | 9 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_811:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1071, 0.0357, 0, 0.66, 0.1429, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L6_C0", "label": "enable_load_extension()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2143, 0.0357, 0, 0.66, 0.2857, 925, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_load_extension", "arg_names": [], "import_names": [], "rhs_call_name": "enable_load_extension", "annotation": ""}, "snippet": "con.enable_load_extension(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L9_C0", "label": "execute()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.3214, 0.0357, 0, 0.66, 0.4286, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"select load_extension('./fts3.so')\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L15_C0", "label": "enable_load_extension()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.5357, 0.0357, 0, 0.66, 0.5714, 925, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "enable_load_extension", "arg_names": [], "import_names": [], "rhs_call_name": "enable_load_extension", "annotation": ""}, "snippet": "con.enable_load_extension(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.6429, 0.0357, 0, 0.66, 0.7143, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create virtual table recipe using fts3(name, ingredients)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L19_C0", "label": "executescript()", "type": "expression", "loc": [19, 24], "level": 0, "parent": null, "vector": [8, 0, 0.7679, 0.2143, 0, 0.66, 0.8571, 675, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "executescript", "arg_names": [], "import_names": [], "rhs_call_name": "executescript", "annotation": ""}, "snippet": "con.executescript(\"\"\"\n insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');\n insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');\n insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');\n insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:For_L25_C0", "label": "for row", "type": "for", "loc": [25, 26], "level": 0, "parent": null, "vector": [6, 0, 0.9107, 0.0714, 0, 0.66, 1.0, 767, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in con.execute(\"select rowid, name, ingredients from recipe where name match 'pie'\"):\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L26_C4", "label": "print()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_811:For_L25_C0", "vector": [8, 1, 0.9286, 0.0357, 1, 0.8, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_811:For_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_811:Expr_L26_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
persons = [
("Hugo", "Boss"),
("Calvin", "Klein")
]
con = sqlite3.connect(":memory:")
# Create the table
con.execute("create table person(firstname, lastname)")
# Fill the table
con.executemany("insert into person(firstname, lastname) values (?, ?)", persons)
# Print the table contents
for row in con.execute("select firstname, lastname from person"):
print row
# Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
print "I just deleted", con.execute("delete from person where 1=1").rowcount, "rows"
| ajibawa-2023/Python-Code-Large/train/row_812 | 8 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_812:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Assign_L3_C0", "label": "persons =", "type": "assigned_variable", "loc": [3, 6], "level": 0, "parent": null, "vector": [14, 0, 0.2143, 0.1905, 0, 0.66, 0.1667, 70, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "persons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "persons = [\n (\"Hugo\", \"Boss\"),\n (\"Calvin\", \"Klein\")\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.381, 0.0476, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L11_C0", "label": "execute()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.5238, 0.0476, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "con.execute(\"create table person(firstname, lastname)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L14_C0", "label": "executemany()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0476, 0, 0.66, 0.6667, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "con.executemany(\"insert into person(firstname, lastname) values (?, ?)\", persons)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:For_L17_C0", "label": "for row", "type": "for", "loc": [17, 18], "level": 0, "parent": null, "vector": [6, 0, 0.8333, 0.0952, 0, 0.66, 0.8333, 767, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for row in con.execute(\"select firstname, lastname from person\"):\n print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L18_C4", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_812:For_L17_C0", "vector": [8, 1, 0.8571, 0.0476, 1, 0.82, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L21_C0", "label": "print()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0476, 0, 0.66, 1.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"I just deleted\", con.execute(\"delete from person where 1=1\").rowcount, \"rows\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_812:For_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_812:Expr_L18_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
locals())
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_813 | 7 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_813:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0833, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 11], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.1667, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_813:Expr_L12_C0", "label": "print()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0833, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}] | [] |
# Not referenced from the documentation, but builds the database file the other
# code snippets expect.
from pysqlite2 import dbapi2 as sqlite3
import os
DB_FILE = "mydb"
if os.path.exists(DB_FILE):
os.remove(DB_FILE)
con = sqlite3.connect(DB_FILE)
cur = con.cursor()
cur.execute("""
create table people
(
name_last varchar(20),
age integer
)
""")
cur.execute("insert into people (name_last, age) values ('Yeltsin', 72)")
cur.execute("insert into people (name_last, age) values ('Putin', 51)")
con.commit()
cur.close()
con.close()
| ajibawa-2023/Python-Code-Large/train/row_814 | 13 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_814:ImportFrom_L4_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0357, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Import_L5_C0", "label": "os import os", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1786, 0.0357, 0, 0.66, 0.0909, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Assign_L7_C0", "label": "DB_FILE =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0357, 0, 0.66, 0.1818, 437, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DB_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DB_FILE = \"mydb\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:If_L9_C0", "label": "if", "type": "if", "loc": [9, 10], "level": 0, "parent": null, "vector": [4, 0, 0.3393, 0.0714, 0, 0.66, 0.2727, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os.path.exists(DB_FILE):\n os.remove(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L10_C4", "label": "remove()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_814:If_L9_C0", "vector": [8, 1, 0.3571, 0.0357, 1, 0.2, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Assign_L12_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0357, 0, 0.66, 0.3636, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(DB_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Assign_L13_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.4643, 0.0357, 0, 0.66, 0.4545, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L14_C0", "label": "execute()", "type": "expression", "loc": [14, 20], "level": 0, "parent": null, "vector": [8, 0, 0.6071, 0.25, 0, 0.66, 0.5455, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"\"\"\n create table people\n (\n name_last varchar(20),\n age integer\n )\n \"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L22_C0", "label": "execute()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.7857, 0.0357, 0, 0.66, 0.6364, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into people (name_last, age) values ('Yeltsin', 72)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L23_C0", "label": "execute()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.8214, 0.0357, 0, 0.66, 0.7273, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into people (name_last, age) values ('Putin', 51)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L25_C0", "label": "commit()", "type": "expression", "loc": [25, 25], "level": 0, "parent": null, "vector": [8, 0, 0.8929, 0.0357, 0, 0.66, 0.8182, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "con.commit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L27_C0", "label": "close()", "type": "expression", "loc": [27, 27], "level": 0, "parent": null, "vector": [8, 0, 0.9643, 0.0357, 0, 0.66, 0.9091, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L28_C0", "label": "close()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0357, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_814:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_814:Expr_L10_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
who = "Yeltsin"
age = 72
cur.execute("select name_last, age from people where name_last=:who and age=:age",
{"who": who, "age": age})
print cur.fetchone()
| ajibawa-2023/Python-Code-Large/train/row_815 | 7 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_815:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0833, 0, 0.66, 0.1667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.0833, 0, 0.66, 0.3333, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Assign_L7_C0", "label": "who =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0833, 0, 0.66, 0.5, 563, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "who", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "who = \"Yeltsin\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Assign_L8_C0", "label": "age =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 657, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "age", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "age = 72"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 11], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.1667, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select name_last, age from people where name_last=:who and age=:age\",\n {\"who\": who, \"age\": age})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_815:Expr_L12_C0", "label": "print()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0833, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone())"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
import datetime
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
cur = con.cursor()
cur.execute('select ? as "x [timestamp]"', (datetime.datetime.now(),))
dt = cur.fetchone()[0]
print dt, type(dt)
| ajibawa-2023/Python-Code-Large/train/row_816 | 7 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_816:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Import_L2_C0", "label": "datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.125, 0, 0.66, 0.1667, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Assign_L4_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.125, 0, 0.66, 0.3333, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.625, 0.125, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Expr_L6_C0", "label": "execute()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.125, 0, 0.66, 0.6667, 569, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select ? as \"x [timestamp]\"', (datetime.datetime.now(),))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Assign_L7_C0", "label": "dt =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.125, 0, 0.66, 0.8333, 455, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dt = cur.fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_816:Expr_L8_C0", "label": "print()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.125, 0, 0.66, 1.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(dt, type(dt))"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
def char_generator():
import string
for c in string.letters[:26]:
yield (c,)
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table characters(c)")
cur.executemany("insert into characters(c) values (?)", char_generator())
cur.execute("select c from characters")
print cur.fetchall()
| ajibawa-2023/Python-Code-Large/train/row_817 | 11 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_817:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "label": "char_generator", "type": "function", "loc": [3, 6], "level": 0, "parent": null, "vector": [2, 0, 0.3, 0.2667, 0, 0.66, 0.1429, 806, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "char_generator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def char_generator():\n import string\n for c in string.letters[:26]:\n yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Import_L4_C4", "label": "string import string", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "vector": [1, 1, 0.2667, 0.0667, 1, 0.17, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": " import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:For_L5_C4", "label": "for c", "type": "for", "loc": [5, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "vector": [6, 1, 0.3667, 0.1333, 1, 0.17, 1.0, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in string.letters[:26]:\n yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L6_C8", "label": "expression", "type": "expression", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_817:For_L5_C4", "vector": [8, 2, 0.4, 0.0667, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield (c,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.5333, 0.0667, 0, 0.66, 0.2857, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Assign_L9_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0667, 0, 0.66, 0.4286, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L10_C0", "label": "execute()", "type": "expression", "loc": [10, 10], "level": 0, "parent": null, "vector": [8, 0, 0.6667, 0.0667, 0, 0.66, 0.5714, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table characters(c)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L12_C0", "label": "executemany()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0667, 0, 0.66, 0.7143, 175, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into characters(c) values (?)\", char_generator())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L14_C0", "label": "execute()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.9333, 0.0667, 0, 0.66, 0.8571, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select c from characters\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0667, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_817:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_817:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_817:For_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_817:For_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_817:Expr_L6_C8"}] |
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect("mydb")
cur = con.cursor()
newPeople = (
('Lebed' , 53),
('Zhirinovsky' , 57),
)
for person in newPeople:
cur.execute("insert into people (name_last, age) values (?, ?)", person)
# The changes will not be saved unless the transaction is committed explicitly:
con.commit()
| ajibawa-2023/Python-Code-Large/train/row_818 | 7 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_818:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:Assign_L3_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1875, 0.0625, 0, 0.66, 0.2, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\"mydb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:Assign_L5_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.3125, 0.0625, 0, 0.66, 0.4, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:Assign_L7_C0", "label": "newPeople =", "type": "assigned_variable", "loc": [7, 10], "level": 0, "parent": null, "vector": [14, 0, 0.5312, 0.25, 0, 0.66, 0.6, 423, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "newPeople", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "newPeople = (\n ('Lebed' , 53),\n ('Zhirinovsky' , 57),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:For_L12_C0", "label": "for person", "type": "for", "loc": [12, 13], "level": 0, "parent": null, "vector": [6, 0, 0.7812, 0.125, 0, 0.66, 0.8, 583, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "person", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for person in newPeople:\n cur.execute(\"insert into people (name_last, age) values (?, ?)\", person)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:Expr_L13_C4", "label": "execute()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_818:For_L12_C0", "vector": [8, 1, 0.8125, 0.0625, 1, 0.33, 0.0, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cur.execute(\"insert into people (name_last, age) values (?, ?)\", person)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_818:Expr_L16_C0", "label": "commit()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0625, 0, 0.66, 1.0, 281, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "commit", "arg_names": [], "import_names": [], "rhs_call_name": "commit", "annotation": ""}, "snippet": "con.commit()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_818:For_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_818:Expr_L13_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __conform__(self, protocol):
if protocol is sqlite3.PrepareProtocol:
return "%f;%f" % (self.x, self.y)
con = sqlite3.connect(":memory:")
cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute("select ?", (p,))
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_819 | 12 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_819:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 9], "level": 0, "parent": null, "vector": [3, 0, 0.375, 0.4375, 0, 0.66, 0.1667, 652, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __conform__(self, protocol):\n if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "vector": [2, 1, 0.2812, 0.125, 1, 0.35, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4", "vector": [14, 2, 0.3125, 0.0625, 2, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L7_C4", "label": "__conform__", "type": "function", "loc": [7, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "vector": [2, 1, 0.5, 0.1875, 1, 0.35, 1.0, 753, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__conform__", "arg_names": ["self", "protocol"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __conform__(self, protocol):\n if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:If_L8_C8", "label": "if", "type": "if", "loc": [8, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L7_C4", "vector": [4, 2, 0.5312, 0.125, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if protocol is sqlite3.PrepareProtocol:\n return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Return_L9_C12", "label": "return", "type": "return", "loc": [9, 9], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_819:If_L8_C8", "vector": [13, 3, 0.5625, 0.0625, 3, 0.87, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L11_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.6875, 0.0625, 0, 0.66, 0.3333, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L12_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0625, 0, 0.66, 0.5, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L14_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.0625, 0, 0.66, 0.6667, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Expr_L15_C0", "label": "execute()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.9375, 0.0625, 0, 0.66, 0.8333, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_819:Expr_L16_C0", "label": "print()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0625, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_819:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_819:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_819:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_819:If_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_819:If_L8_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_819:Return_L9_C12"}] |
from pysqlite2 import dbapi2 as sqlite3
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __repr__(self):
return "(%f;%f)" % (self.x, self.y)
def adapt_point(point):
return "%f;%f" % (point.x, point.y)
def convert_point(s):
x, y = map(float, s.split(";"))
return Point(x, y)
# Register the adapter
sqlite3.register_adapter(Point, adapt_point)
# Register the converter
sqlite3.register_converter("point", convert_point)
p = Point(4.0, -3.2)
#########################
# 1) Using declared types
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)
cur = con.cursor()
cur.execute("create table test(p point)")
cur.execute("insert into test(p) values (?)", (p,))
cur.execute("select p from test")
print "with declared types:", cur.fetchone()[0]
cur.close()
con.close()
#######################
# 1) Using column names
con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_COLNAMES)
cur = con.cursor()
cur.execute("create table test(p)")
cur.execute("insert into test(p) values (?)", (p,))
cur.execute('select p as "p [point]" from test')
print "with column names:", cur.fetchone()[0]
cur.close()
con.close()
| ajibawa-2023/Python-Code-Large/train/row_820 | 30 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_820:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "label": "Point", "type": "class", "loc": [3, 8], "level": 0, "parent": null, "vector": [3, 0, 0.117, 0.1277, 0, 0.66, 0.0455, 652, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Point", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Point(object):\n def __init__(self, x, y):\n self.x, self.y = x, y\n\n def __repr__(self):\n return \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "vector": [2, 1, 0.0957, 0.0426, 1, 0.84, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "x", "y"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, x, y):\n self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L5_C8", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4", "vector": [14, 2, 0.1064, 0.0213, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.x, self.y = x, y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L7_C4", "label": "__repr__", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "vector": [2, 1, 0.1596, 0.0426, 1, 0.84, 1.0, 204, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L7_C4", "vector": [13, 2, 0.1702, 0.0213, 2, 0.03, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"(%f;%f)\" % (self.x, self.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L10_C0", "label": "adapt_point", "type": "function", "loc": [10, 11], "level": 0, "parent": null, "vector": [2, 0, 0.2234, 0.0426, 0, 0.66, 0.0909, 704, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "adapt_point", "arg_names": ["point"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_point(point):\n return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L11_C4", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L10_C0", "vector": [13, 1, 0.234, 0.0213, 1, 0.28, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%f;%f\" % (point.x, point.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L13_C0", "label": "convert_point", "type": "function", "loc": [13, 15], "level": 0, "parent": null, "vector": [2, 0, 0.2979, 0.0638, 0, 0.66, 0.1364, 480, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "convert_point", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convert_point(s):\n x, y = map(float, s.split(\";\"))\n return Point(x, y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L14_C4", "label": "x, y = map()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L13_C0", "vector": [14, 1, 0.2979, 0.0213, 1, 0.44, 0.0, 855, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "x, y", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " x, y = map(float, s.split(\";\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L15_C4", "label": "return", "type": "return", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L13_C0", "vector": [13, 1, 0.3191, 0.0213, 1, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Point(x, y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L18_C0", "label": "register_adapter()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.383, 0.0213, 0, 0.66, 0.1818, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(Point, adapt_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L21_C0", "label": "register_converter()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.4468, 0.0213, 0, 0.66, 0.2273, 121, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_converter", "arg_names": [], "import_names": [], "rhs_call_name": "register_converter", "annotation": ""}, "snippet": "sqlite3.register_converter(\"point\", convert_point)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L23_C0", "label": "p = Point()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.4894, 0.0213, 0, 0.66, 0.2727, 491, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "Point", "annotation": ""}, "snippet": "p = Point(4.0, -3.2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L27_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.5745, 0.0213, 0, 0.66, 0.3182, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L28_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.5957, 0.0213, 0, 0.66, 0.3636, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L29_C0", "label": "execute()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.617, 0.0213, 0, 0.66, 0.4091, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(p point)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L31_C0", "label": "execute()", "type": "expression", "loc": [31, 31], "level": 0, "parent": null, "vector": [8, 0, 0.6596, 0.0213, 0, 0.66, 0.4545, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(p) values (?)\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L32_C0", "label": "execute()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 0.6809, 0.0213, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select p from test\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L33_C0", "label": "print()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.7021, 0.0213, 0, 0.66, 0.5455, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"with declared types:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L34_C0", "label": "close()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.7234, 0.0213, 0, 0.66, 0.5909, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L35_C0", "label": "close()", "type": "expression", "loc": [35, 35], "level": 0, "parent": null, "vector": [8, 0, 0.7447, 0.0213, 0, 0.66, 0.6364, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L39_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.8298, 0.0213, 0, 0.66, 0.6818, 761, 3, 2, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L40_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.8511, 0.0213, 0, 0.66, 0.7273, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L41_C0", "label": "execute()", "type": "expression", "loc": [41, 41], "level": 0, "parent": null, "vector": [8, 0, 0.8723, 0.0213, 0, 0.66, 0.7727, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table test(p)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L43_C0", "label": "execute()", "type": "expression", "loc": [43, 43], "level": 0, "parent": null, "vector": [8, 0, 0.9149, 0.0213, 0, 0.66, 0.8182, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"insert into test(p) values (?)\", (p,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L44_C0", "label": "execute()", "type": "expression", "loc": [44, 44], "level": 0, "parent": null, "vector": [8, 0, 0.9362, 0.0213, 0, 0.66, 0.8636, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute('select p as \"p [point]\" from test')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L45_C0", "label": "print()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.9574, 0.0213, 0, 0.66, 0.9091, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"with column names:\", cur.fetchone()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L46_C0", "label": "close()", "type": "expression", "loc": [46, 46], "level": 0, "parent": null, "vector": [8, 0, 0.9787, 0.0213, 0, 0.66, 0.9545, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "cur.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_820:Expr_L47_C0", "label": "close()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0213, 0, 0.66, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_820:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_820:Return_L15_C4"}] |
from pysqlite2 import dbapi2 as sqlite3
class IterChars:
def __init__(self):
self.count = ord('a')
def __iter__(self):
return self
def next(self):
if self.count > ord('z'):
raise StopIteration
self.count += 1
return (chr(self.count - 1),) # this is a 1-tuple
con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.execute("create table characters(c)")
theIter = IterChars()
cur.executemany("insert into characters(c) values (?)", theIter)
cur.execute("select c from characters")
print cur.fetchall()
| ajibawa-2023/Python-Code-Large/train/row_821 | 16 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_821:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "label": "IterChars", "type": "class", "loc": [3, 14], "level": 0, "parent": null, "vector": [3, 0, 0.3542, 0.5, 0, 0.66, 0.125, 192, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "IterChars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IterChars:\n def __init__(self):\n self.count = ord('a')\n\n def __iter__(self):\n return self\n\n def next(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "vector": [2, 1, 0.1875, 0.0833, 1, 0.68, 0.0, 555, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.count = ord('a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L5_C8", "label": "self.count = ord()", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4", "vector": [14, 2, 0.2083, 0.0417, 2, 0.84, 0.0, 340, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "self.count", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " self.count = ord('a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L7_C4", "label": "__iter__", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "vector": [2, 1, 0.3125, 0.0833, 1, 0.68, 0.5, 891, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Return_L8_C8", "label": "return", "type": "return", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L7_C4", "vector": [13, 2, 0.3333, 0.0417, 2, 0.35, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4", "label": "next", "type": "function", "loc": [10, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "vector": [2, 1, 0.5, 0.2083, 1, 0.68, 1.0, 11, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def next(self):\n if self.count > ord('z'):\n raise StopIteration\n self.count += 1\n return (chr(self.count - 1),) # this is a 1-tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:If_L11_C8", "label": "if", "type": "if", "loc": [11, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4", "vector": [4, 2, 0.4792, 0.0833, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.count > ord('z'):\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4", "vector": [13, 2, 0.5833, 0.0417, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (chr(self.count - 1),) # this is a 1-tuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L16_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0417, 0, 0.66, 0.25, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L17_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.7083, 0.0417, 0, 0.66, 0.375, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Expr_L18_C0", "label": "execute()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.0417, 0, 0.66, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"create table characters(c)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L20_C0", "label": "theIter = IterChars()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0417, 0, 0.66, 0.625, 800, 3, 0, 0, 0, 192, 10, 1], "semantic": {"name": "theIter", "arg_names": [], "import_names": [], "rhs_call_name": "IterChars", "annotation": ""}, "snippet": "theIter = IterChars()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Expr_L21_C0", "label": "executemany()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.875, 0.0417, 0, 0.66, 0.75, 175, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "executemany", "arg_names": [], "import_names": [], "rhs_call_name": "executemany", "annotation": ""}, "snippet": "cur.executemany(\"insert into characters(c) values (?)\", theIter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Expr_L23_C0", "label": "execute()", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.9583, 0.0417, 0, 0.66, 0.875, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select c from characters\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_821:Expr_L24_C0", "label": "print()", "type": "expression", "loc": [24, 24], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0417, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchall())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_821:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_821:Return_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_821:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_821:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_821:Return_L14_C8"}] |
from pysqlite2 import dbapi2 as sqlite3
import apsw
apsw_con = apsw.Connection(":memory:")
apsw_con.createscalarfunction("times_two", lambda x: 2*x, 1)
# Create pysqlite connection from APSW connection
con = sqlite3.connect(apsw_con)
result = con.execute("select times_two(15)").fetchone()[0]
assert result == 30
con.close()
| ajibawa-2023/Python-Code-Large/train/row_822 | 7 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_822:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Import_L2_C0", "label": "apsw import apsw", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.1667, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "apsw", "arg_names": [], "import_names": ["apsw"], "rhs_call_name": "", "annotation": ""}, "snippet": "import apsw"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Assign_L4_C0", "label": "apsw_con = Connection()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0833, 0, 0.66, 0.3333, 112, 3, 1, 0, 0, 823, 10, 1], "semantic": {"name": "apsw_con", "arg_names": [], "import_names": [], "rhs_call_name": "Connection", "annotation": ""}, "snippet": "apsw_con = apsw.Connection(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Expr_L5_C0", "label": "createscalarfunction()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.4167, 0.0833, 0, 0.66, 0.5, 36, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "createscalarfunction", "arg_names": [], "import_names": [], "rhs_call_name": "createscalarfunction", "annotation": ""}, "snippet": "apsw_con.createscalarfunction(\"times_two\", lambda x: 2*x, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Assign_L8_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0833, 0, 0.66, 0.6667, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(apsw_con)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Assign_L9_C0", "label": "result =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.0833, 0, 0.66, 0.8333, 51, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "result = con.execute(\"select times_two(15)\").fetchone()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_822:Expr_L11_C0", "label": "close()", "type": "expression", "loc": [11, 11], "level": 0, "parent": null, "vector": [8, 0, 0.9167, 0.0833, 0, 0.66, 1.1667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "con.close()"}] | [] |
from pysqlite2 import dbapi2 as sqlite3
import datetime, time
def adapt_datetime(ts):
return time.mktime(ts.timetuple())
sqlite3.register_adapter(datetime.datetime, adapt_datetime)
con = sqlite3.connect(":memory:")
cur = con.cursor()
now = datetime.datetime.now()
cur.execute("select ?", (now,))
print cur.fetchone()[0]
| ajibawa-2023/Python-Code-Large/train/row_823 | 10 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_823:ImportFrom_L1_C0", "label": "from pysqlite2 import sqlite3", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Import_L2_C0", "label": "datetime import datetime, time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.125, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime", "time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime, time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:FunctionDef_L4_C0", "label": "adapt_datetime", "type": "function", "loc": [4, 5], "level": 0, "parent": null, "vector": [2, 0, 0.3214, 0.1429, 0, 0.66, 0.25, 242, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "adapt_datetime", "arg_names": ["ts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def adapt_datetime(ts):\n return time.mktime(ts.timetuple())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Return_L5_C4", "label": "return", "type": "return", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_823:FunctionDef_L4_C0", "vector": [13, 1, 0.3571, 0.0714, 1, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return time.mktime(ts.timetuple())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Expr_L7_C0", "label": "register_adapter()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0714, 0, 0.66, 0.375, 339, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_adapter", "arg_names": [], "import_names": [], "rhs_call_name": "register_adapter", "annotation": ""}, "snippet": "sqlite3.register_adapter(datetime.datetime, adapt_datetime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Assign_L9_C0", "label": "con = connect()", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.6429, 0.0714, 0, 0.66, 0.5, 761, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "con", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "con = sqlite3.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Assign_L10_C0", "label": "cur = cursor()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.0714, 0, 0.66, 0.625, 834, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cur", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": "cur = con.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Assign_L12_C0", "label": "now = now()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.8571, 0.0714, 0, 0.66, 0.75, 894, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": "now = datetime.datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Expr_L13_C0", "label": "execute()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.9286, 0.0714, 0, 0.66, 0.875, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": "cur.execute(\"select ?\", (now,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_823:Expr_L14_C0", "label": "print()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0714, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(cur.fetchone()[0])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_823:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_823:Return_L5_C4"}] |
# Author: Paul Kippes <kippesp@gmail.com>
import unittest
from pysqlite2 import dbapi2 as sqlite
class DumpTests(unittest.TestCase):
def setUp(self):
self.cx = sqlite.connect(":memory:")
self.cu = self.cx.cursor()
def tearDown(self):
self.cx.close()
def CheckTableDump(self):
expected_sqls = [
"CREATE TABLE t1(id integer primary key, s1 text, " \
"t1_i1 integer not null, i2 integer, unique (s1), " \
"constraint t1_idx1 unique (i2));"
,
"INSERT INTO \"t1\" VALUES(1,'foo',10,20);"
,
"INSERT INTO \"t1\" VALUES(2,'foo2',30,30);"
,
"CREATE TABLE t2(id integer, t2_i1 integer, " \
"t2_i2 integer, primary key (id)," \
"foreign key(t2_i1) references t1(t1_i1));"
,
"CREATE TRIGGER trigger_1 update of t1_i1 on t1 " \
"begin " \
"update t2 set t2_i1 = new.t1_i1 where t2_i1 = old.t1_i1; " \
"end;"
,
"CREATE VIEW v1 as select * from t1 left join t2 " \
"using (id);"
]
[self.cu.execute(s) for s in expected_sqls]
i = self.cx.iterdump()
actual_sqls = [s for s in i]
expected_sqls = ['BEGIN TRANSACTION;'] + expected_sqls + \
['COMMIT;']
[self.assertEqual(expected_sqls[i], actual_sqls[i])
for i in xrange(len(expected_sqls))]
def suite():
return unittest.TestSuite(unittest.makeSuite(DumpTests, "Check"))
def test():
runner = unittest.TextTestRunner()
runner.run(suite())
if __name__ == "__main__":
test()
| ajibawa-2023/Python-Code-Large/train/row_824 | 22 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_824:Import_L3_C0", "label": "unittest import unittest", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0577, 0.0192, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:ImportFrom_L4_C0", "label": "from pysqlite2 import sqlite", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0192, 0, 0.66, 0.2, 987, 0, 1, 0, 0, 987, 0, 0], "semantic": {"name": "pysqlite2", "arg_names": [], "import_names": ["sqlite"], "rhs_call_name": "", "annotation": ""}, "snippet": "from pysqlite2 import dbapi2 as sqlite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "label": "DumpTests", "type": "class", "loc": [6, 42], "level": 0, "parent": null, "vector": [3, 0, 0.4615, 0.7115, 0, 0.66, 0.4, 461, 0, 3, 0, 0, 878, 0, 8], "semantic": {"name": "DumpTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DumpTests(unittest.TestCase):\n def setUp(self):\n self.cx = sqlite.connect(\":memory:\")\n self.cu = self.cx.cursor()\n\n def tearDown(self):\n self.cx.close()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "label": "setUp", "type": "function", "loc": [7, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "vector": [2, 1, 0.1538, 0.0577, 1, 0.74, 0.0, 952, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.cx = sqlite.connect(\":memory:\")\n self.cu = self.cx.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L8_C8", "label": "self.cx = connect()", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "vector": [14, 2, 0.1538, 0.0192, 2, 0.25, 0.0, 349, 3, 1, 0, 0, 242, 10, 1], "semantic": {"name": "self.cx", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.cx = sqlite.connect(\":memory:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L9_C8", "label": "self.cu = cursor()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "vector": [14, 2, 0.1731, 0.0192, 2, 0.25, 1.0, 914, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "self.cu", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " self.cu = self.cx.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L11_C4", "label": "tearDown", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "vector": [2, 1, 0.2212, 0.0385, 1, 0.74, 0.5, 530, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "tearDown", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tearDown(self):\n self.cx.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L12_C8", "label": "close()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L11_C4", "vector": [8, 2, 0.2308, 0.0192, 2, 0.02, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.cx.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "label": "CheckTableDump", "type": "function", "loc": [14, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "vector": [2, 1, 0.5385, 0.5577, 1, 0.74, 1.0, 300, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "CheckTableDump", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def CheckTableDump(self):\n expected_sqls = [\n \"CREATE TABLE t1(id integer primary key, s1 text, \" \\\n \"t1_i1 integer not null, i2 integer, unique (s1), \" \\\n \"constraint t1_idx1 unique (i2));\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(1,'foo',10,20);\"\n ,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L15_C8", "label": "expected_sqls =", "type": "assigned_variable", "loc": [15, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [14, 2, 0.4808, 0.4038, 2, 0.71, 0.0, 56, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "expected_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected_sqls = [\n \"CREATE TABLE t1(id integer primary key, s1 text, \" \\\n \"t1_i1 integer not null, i2 integer, unique (s1), \" \\\n \"constraint t1_idx1 unique (i2));\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(1,'foo',10,20);\"\n ,\n \"INSERT INTO \\\"t1\\\" VALUES(2,'foo2',30,30);\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L36_C8", "label": "expression", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [8, 2, 0.6923, 0.0192, 2, 0.71, 0.2, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [self.cu.execute(s) for s in expected_sqls]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L37_C8", "label": "i = iterdump()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [14, 2, 0.7115, 0.0192, 2, 0.71, 0.4, 826, 3, 0, 0, 0, 277, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "iterdump", "annotation": ""}, "snippet": " i = self.cx.iterdump()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L38_C8", "label": "actual_sqls =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [14, 2, 0.7308, 0.0192, 2, 0.71, 0.6, 863, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "actual_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " actual_sqls = [s for s in i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L39_C8", "label": "expected_sqls =", "type": "assigned_variable", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [14, 2, 0.7596, 0.0385, 2, 0.71, 0.8, 56, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected_sqls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected_sqls = ['BEGIN TRANSACTION;'] + expected_sqls + \\\n ['COMMIT;']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "vector": [8, 2, 0.7981, 0.0385, 2, 0.71, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " [self.assertEqual(expected_sqls[i], actual_sqls[i])\n for i in xrange(len(expected_sqls))]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L44_C0", "label": "suite", "type": "function", "loc": [44, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8558, 0.0385, 0, 0.66, 0.6, 425, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n return unittest.TestSuite(unittest.makeSuite(DumpTests, \"Check\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Return_L45_C4", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L44_C0", "vector": [13, 1, 0.8654, 0.0192, 1, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unittest.TestSuite(unittest.makeSuite(DumpTests, \"Check\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L47_C0", "label": "test", "type": "function", "loc": [47, 49], "level": 0, "parent": null, "vector": [2, 0, 0.9231, 0.0577, 0, 0.66, 0.8, 224, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n runner = unittest.TextTestRunner()\n runner.run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L48_C4", "label": "runner = TextTestRunner()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L47_C0", "vector": [14, 1, 0.9231, 0.0192, 1, 0.32, 0.0, 180, 3, 0, 0, 0, 130, 10, 1], "semantic": {"name": "runner", "arg_names": [], "import_names": [], "rhs_call_name": "TextTestRunner", "annotation": ""}, "snippet": " runner = unittest.TextTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L49_C4", "label": "run()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L47_C0", "vector": [8, 1, 0.9423, 0.0192, 1, 0.32, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " runner.run(suite())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:If_L51_C0", "label": "if", "type": "if", "loc": [51, 52], "level": 0, "parent": null, "vector": [4, 0, 0.9904, 0.0385, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n test()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L52_C4", "label": "test()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_824:If_L51_C0", "vector": [8, 1, 1.0, 0.0192, 1, 0.67, 0.0, 224, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Return_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_824:If_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_824:Expr_L52_C4"}] |
# Mimic the sqlite3 console shell's .dump command
# Author: Paul Kippes <kippesp@gmail.com>
def _iterdump(connection):
"""
Returns an iterator to the dump of the database in an SQL text format.
Used to produce an SQL dump of the database. Useful to save an in-memory
database for later restoration. This function should not be called
directly but instead called from the Connection method, iterdump().
"""
cu = connection.cursor()
yield('BEGIN TRANSACTION;')
# sqlite_master table contains the SQL CREATE statements for the database.
q = """
SELECT name, type, sql
FROM sqlite_master
WHERE sql NOT NULL AND
type == 'table'
"""
schema_res = cu.execute(q)
for table_name, type, sql in schema_res.fetchall():
if table_name == 'sqlite_sequence':
yield('DELETE FROM sqlite_sequence;')
elif table_name == 'sqlite_stat1':
yield('ANALYZE sqlite_master;')
elif table_name.startswith('sqlite_'):
continue
# NOTE: Virtual table support not implemented
#elif sql.startswith('CREATE VIRTUAL TABLE'):
# qtable = table_name.replace("'", "''")
# yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"\
# "VALUES('table','%s','%s',0,'%s');" %
# qtable,
# qtable,
# sql.replace("''"))
else:
yield('%s;' % sql)
# Build the insert statement for each row of the current table
res = cu.execute("PRAGMA table_info('%s')" % table_name)
column_names = [str(table_info[1]) for table_info in res.fetchall()]
q = "SELECT 'INSERT INTO \"%(tbl_name)s\" VALUES("
q += ",".join(["'||quote(" + col + ")||'" for col in column_names])
q += ")' FROM '%(tbl_name)s'"
query_res = cu.execute(q % {'tbl_name': table_name})
for row in query_res:
yield("%s;" % row[0])
# Now when the type is 'index', 'trigger', or 'view'
q = """
SELECT name, type, sql
FROM sqlite_master
WHERE sql NOT NULL AND
type IN ('index', 'trigger', 'view')
"""
schema_res = cu.execute(q)
for name, type, sql in schema_res.fetchall():
yield('%s;' % sql)
yield('COMMIT;')
| ajibawa-2023/Python-Code-Large/train/row_825 | 24 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "label": "_iterdump", "type": "function", "loc": [4, 63], "level": 0, "parent": null, "vector": [2, 0, 0.5317, 0.9524, 0, 0.66, 0.0, 339, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "_iterdump", "arg_names": ["connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _iterdump(connection):\n \"\"\"\n Returns an iterator to the dump of the database in an SQL text format.\n\n Used to produce an SQL dump of the database. Useful to save an in-memory\n database for later restoration. This function should not be called\n directly but instead called from the Connection method, iterdump().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [8, 1, 0.127, 0.1111, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns an iterator to the dump of the database in an SQL text format.\n\n Used to produce an SQL dump of the database. Useful to save an in-memory\n database for later restoration. This function should not be called\n directly but instead called from the Connection method, iterdump().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L13_C4", "label": "cu = cursor()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [14, 1, 0.2063, 0.0159, 1, 0.03, 0.1111, 145, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cu", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cu = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [8, 1, 0.2222, 0.0159, 1, 0.03, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('BEGIN TRANSACTION;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L17_C4", "label": "q =", "type": "assigned_variable", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [14, 1, 0.3095, 0.0952, 1, 0.03, 0.3333, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"\"\"\n SELECT name, type, sql\n FROM sqlite_master\n WHERE sql NOT NULL AND\n type == 'table'\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L23_C4", "label": "schema_res = execute()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [14, 1, 0.3651, 0.0159, 1, 0.03, 0.4444, 84, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "schema_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " schema_res = cu.execute(q)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "label": "for table_name, type, sql", "type": "for", "loc": [24, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [6, 1, 0.5873, 0.4286, 1, 0.03, 0.5556, 166, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "table_name, type, sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for table_name, type, sql in schema_res.fetchall():\n if table_name == 'sqlite_sequence':\n yield('DELETE FROM sqlite_sequence;')\n elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8", "label": "if", "type": "if", "loc": [25, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [4, 2, 0.5159, 0.254, 2, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if table_name == 'sqlite_sequence':\n yield('DELETE FROM sqlite_sequence;')\n elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L26_C12", "label": "expression", "type": "expression", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8", "vector": [8, 3, 0.4127, 0.0159, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('DELETE FROM sqlite_sequence;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8", "label": "if", "type": "if", "loc": [27, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8", "vector": [4, 3, 0.5317, 0.2222, 3, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif table_name == 'sqlite_stat1':\n yield('ANALYZE sqlite_master;')\n elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):\n # qtable = table_name.replace(\"'\", \"''\")\n # yield(\"INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)\"\\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L28_C12", "label": "expression", "type": "expression", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8", "vector": [8, 4, 0.4444, 0.0159, 4, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('ANALYZE sqlite_master;')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:If_L29_C8", "label": "if", "type": "if", "loc": [29, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8", "vector": [4, 4, 0.5476, 0.1905, 4, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif table_name.startswith('sqlite_'):\n continue\n # NOTE: Virtual table support not implemented\n #elif sql.startswith('CREATE VIRTUAL TABLE'):\n # qtable = table_name.replace(\"'\", \"''\")\n # yield(\"INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)\"\\\n # \"VALUES('table','%s','%s',0,'%s');\" %\n # qtable,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L40_C12", "label": "expression", "type": "expression", "loc": [40, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:If_L29_C8", "vector": [8, 5, 0.6349, 0.0159, 5, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L43_C8", "label": "res = execute()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [14, 2, 0.6825, 0.0159, 2, 0.16, 0.2, 413, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " res = cu.execute(\"PRAGMA table_info('%s')\" % table_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L44_C8", "label": "column_names =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [14, 2, 0.6984, 0.0159, 2, 0.16, 0.4, 598, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "column_names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " column_names = [str(table_info[1]) for table_info in res.fetchall()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L45_C8", "label": "q =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [14, 2, 0.7143, 0.0159, 2, 0.16, 0.6, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"SELECT 'INSERT INTO \\\"%(tbl_name)s\\\" VALUES(\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L48_C8", "label": "query_res = execute()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [14, 2, 0.7619, 0.0159, 2, 0.16, 0.8, 20, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "query_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " query_res = cu.execute(q % {'tbl_name': table_name})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:For_L49_C8", "label": "for row", "type": "for", "loc": [49, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "vector": [6, 2, 0.7857, 0.0317, 2, 0.16, 1.0, 767, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in query_res:\n yield(\"%s;\" % row[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L50_C12", "label": "expression", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L49_C8", "vector": [8, 3, 0.7937, 0.0159, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield(\"%s;\" % row[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L53_C4", "label": "q =", "type": "assigned_variable", "loc": [53, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [14, 1, 0.881, 0.0952, 1, 0.03, 0.6667, 516, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " q = \"\"\"\n SELECT name, type, sql\n FROM sqlite_master\n WHERE sql NOT NULL AND\n type IN ('index', 'trigger', 'view')\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L59_C4", "label": "schema_res = execute()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [14, 1, 0.9365, 0.0159, 1, 0.03, 0.7778, 84, 3, 1, 0, 0, 569, 10, 1], "semantic": {"name": "schema_res", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " schema_res = cu.execute(q)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:For_L60_C4", "label": "for name, type, sql", "type": "for", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [6, 1, 0.9603, 0.0317, 1, 0.03, 0.8889, 331, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name, type, sql", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, type, sql in schema_res.fetchall():\n yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L61_C8", "label": "expression", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:For_L60_C4", "vector": [8, 2, 0.9683, 0.0159, 2, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('%s;' % sql)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L63_C4", "label": "expression", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "vector": [8, 1, 1.0, 0.0159, 1, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield('COMMIT;')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:If_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:If_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:If_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:For_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_825:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_825:Expr_L63_C4"}] |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self):
logging.warn('do_GET: %s, %s', self.command, self.path)
url = urlparse.urlparse(self.path)
logging.warn('do_GET: %s', url)
query = urlparse.parse_qs(url.query)
query_keys = [pair[0] for pair in query]
response = self.handle_url(url)
if response != None:
self.send_200()
shutil.copyfileobj(response, self.wfile)
self.wfile.close()
do_POST = do_GET
def handle_url(self, url):
path = None
if url.path == '/v1/venue':
path = '../captures/api/v1/venue.xml'
elif url.path == '/v1/addvenue':
path = '../captures/api/v1/venue.xml'
elif url.path == '/v1/venues':
path = '../captures/api/v1/venues.xml'
elif url.path == '/v1/user':
path = '../captures/api/v1/user.xml'
elif url.path == '/v1/checkcity':
path = '../captures/api/v1/checkcity.xml'
elif url.path == '/v1/checkins':
path = '../captures/api/v1/checkins.xml'
elif url.path == '/v1/cities':
path = '../captures/api/v1/cities.xml'
elif url.path == '/v1/switchcity':
path = '../captures/api/v1/switchcity.xml'
elif url.path == '/v1/tips':
path = '../captures/api/v1/tips.xml'
elif url.path == '/v1/checkin':
path = '../captures/api/v1/checkin.xml'
elif url.path == '/history/12345.rss':
path = '../captures/api/v1/feed.xml'
if path is None:
self.send_error(404)
else:
logging.warn('Using: %s' % path)
return open(path)
def send_200(self):
self.send_response(200)
self.send_header('Content-type', 'text/xml')
self.end_headers()
def main():
if len(sys.argv) > 1:
port = int(sys.argv[1])
else:
port = 8080
server_address = ('0.0.0.0', port)
httpd = BaseHTTPServer.HTTPServer(server_address, RequestHandler)
sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_826 | 63 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L5_C0", "label": "logging import logging", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0118, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L6_C0", "label": "shutil import shutil", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0706, 0.0118, 0, 0.66, 0.125, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L7_C0", "label": "sys import sys", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0824, 0.0118, 0, 0.66, 0.25, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L8_C0", "label": "urlparse import urlparse", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0941, 0.0118, 0, 0.66, 0.375, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L10_C0", "label": "SimpleHTTPServer import SimpleHTTPServer", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0118, 0, 0.66, 0.5, 643, 0, 1, 0, 0, 643, 0, 0], "semantic": {"name": "SimpleHTTPServer", "arg_names": [], "import_names": ["SimpleHTTPServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "import SimpleHTTPServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Import_L11_C0", "label": "BaseHTTPServer import BaseHTTPServer", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1294, 0.0118, 0, 0.66, 0.625, 801, 0, 1, 0, 0, 801, 0, 0], "semantic": {"name": "BaseHTTPServer", "arg_names": [], "import_names": ["BaseHTTPServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "import BaseHTTPServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "label": "RequestHandler", "type": "class", "loc": [14, 68], "level": 0, "parent": null, "vector": [3, 0, 0.4824, 0.6471, 0, 0.66, 0.75, 200, 0, 3, 0, 0, 814, 0, 14], "semantic": {"name": "RequestHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s', self.command, self.path)\n\n url = urlparse.urlparse(self.path)\n logging.warn('do_GET: %s', url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L15_C2", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "vector": [8, 1, 0.1765, 0.0118, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handle playfoursquare.com requests, for testing.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "label": "do_GET", "type": "function", "loc": [17, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "vector": [2, 1, 0.2706, 0.1529, 1, 0.74, 0.25, 269, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "do_GET", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_GET(self):\n logging.warn('do_GET: %s, %s', self.command, self.path)\n\n url = urlparse.urlparse(self.path)\n logging.warn('do_GET: %s', url)\n query = urlparse.parse_qs(url.query)\n query_keys = [pair[0] for pair in query]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L18_C4", "label": "warn()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [8, 2, 0.2118, 0.0118, 2, 0.03, 0.0, 960, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('do_GET: %s, %s', self.command, self.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L20_C4", "label": "url = urlparse()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [14, 2, 0.2353, 0.0118, 2, 0.03, 0.1429, 789, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " url = urlparse.urlparse(self.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L21_C4", "label": "warn()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [8, 2, 0.2471, 0.0118, 2, 0.03, 0.2857, 960, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('do_GET: %s', url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L22_C4", "label": "query = parse_qs()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [14, 2, 0.2588, 0.0118, 2, 0.03, 0.4286, 546, 3, 1, 0, 0, 709, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " query = urlparse.parse_qs(url.query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L23_C4", "label": "query_keys =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [14, 2, 0.2706, 0.0118, 2, 0.03, 0.5714, 890, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query_keys = [pair[0] for pair in query]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L25_C4", "label": "response = handle_url()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [14, 2, 0.2941, 0.0118, 2, 0.03, 0.7143, 511, 3, 1, 0, 0, 906, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "handle_url", "annotation": ""}, "snippet": " response = self.handle_url(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4", "label": "if", "type": "if", "loc": [26, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [4, 2, 0.3176, 0.0353, 2, 0.03, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if response != None:\n self.send_200()\n shutil.copyfileobj(response, self.wfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L27_C6", "label": "send_200()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4", "vector": [8, 3, 0.3176, 0.0118, 3, 0.73, 0.0, 966, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "send_200", "arg_names": [], "import_names": [], "rhs_call_name": "send_200", "annotation": ""}, "snippet": " self.send_200()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L28_C6", "label": "copyfileobj()", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4", "vector": [8, 3, 0.3294, 0.0118, 3, 0.73, 1.0, 462, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copyfileobj", "arg_names": [], "import_names": [], "rhs_call_name": "copyfileobj", "annotation": ""}, "snippet": " shutil.copyfileobj(response, self.wfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L29_C4", "label": "close()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "vector": [8, 2, 0.3412, 0.0118, 2, 0.03, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.wfile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L31_C2", "label": "do_POST =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "vector": [14, 1, 0.3647, 0.0118, 1, 0.74, 0.5, 67, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "do_POST", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " do_POST = do_GET"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "label": "handle_url", "type": "function", "loc": [33, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "vector": [2, 1, 0.5647, 0.3647, 1, 0.74, 0.75, 906, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "handle_url", "arg_names": ["self", "url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_url(self, url):\n path = None\n\n if url.path == '/v1/venue':\n path = '../captures/api/v1/venue.xml'\n elif url.path == '/v1/addvenue':\n path = '../captures/api/v1/venue.xml'\n elif url.path == '/v1/venues':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L34_C4", "label": "path =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "vector": [14, 2, 0.4, 0.0118, 2, 0.36, 0.0, 358, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4", "label": "if", "type": "if", "loc": [36, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "vector": [4, 2, 0.5471, 0.2588, 2, 0.36, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url.path == '/v1/venue':\n path = '../captures/api/v1/venue.xml'\n elif url.path == '/v1/addvenue':\n path = '../captures/api/v1/venue.xml'\n elif url.path == '/v1/venues':\n path = '../captures/api/v1/venues.xml'\n elif url.path == '/v1/user':\n path = '../captures/api/v1/user.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L37_C6", "label": "path =", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4", "vector": [14, 3, 0.4353, 0.0118, 3, 0.43, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/venue.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4", "label": "if", "type": "if", "loc": [38, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4", "vector": [4, 3, 0.5588, 0.2353, 3, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/addvenue':\n path = '../captures/api/v1/venue.xml'\n elif url.path == '/v1/venues':\n path = '../captures/api/v1/venues.xml'\n elif url.path == '/v1/user':\n path = '../captures/api/v1/user.xml'\n elif url.path == '/v1/checkcity':\n path = '../captures/api/v1/checkcity.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L39_C6", "label": "path =", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4", "vector": [14, 4, 0.4588, 0.0118, 4, 0.81, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/venue.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4", "label": "if", "type": "if", "loc": [40, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4", "vector": [4, 4, 0.5706, 0.2118, 4, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/venues':\n path = '../captures/api/v1/venues.xml'\n elif url.path == '/v1/user':\n path = '../captures/api/v1/user.xml'\n elif url.path == '/v1/checkcity':\n path = '../captures/api/v1/checkcity.xml'\n elif url.path == '/v1/checkins':\n path = '../captures/api/v1/checkins.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L41_C6", "label": "path =", "type": "assigned_variable", "loc": [41, 41], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4", "vector": [14, 5, 0.4824, 0.0118, 5, 0.91, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/venues.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4", "label": "if", "type": "if", "loc": [42, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4", "vector": [4, 5, 0.5824, 0.1882, 5, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/user':\n path = '../captures/api/v1/user.xml'\n elif url.path == '/v1/checkcity':\n path = '../captures/api/v1/checkcity.xml'\n elif url.path == '/v1/checkins':\n path = '../captures/api/v1/checkins.xml'\n elif url.path == '/v1/cities':\n path = '../captures/api/v1/cities.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L43_C6", "label": "path =", "type": "assigned_variable", "loc": [43, 43], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4", "vector": [14, 6, 0.5059, 0.0118, 6, 0.98, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/user.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4", "label": "if", "type": "if", "loc": [44, 57], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4", "vector": [4, 6, 0.5941, 0.1647, 6, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/checkcity':\n path = '../captures/api/v1/checkcity.xml'\n elif url.path == '/v1/checkins':\n path = '../captures/api/v1/checkins.xml'\n elif url.path == '/v1/cities':\n path = '../captures/api/v1/cities.xml'\n elif url.path == '/v1/switchcity':\n path = '../captures/api/v1/switchcity.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L45_C6", "label": "path =", "type": "assigned_variable", "loc": [45, 45], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4", "vector": [14, 7, 0.5294, 0.0118, 7, 0.07, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/checkcity.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4", "label": "if", "type": "if", "loc": [46, 57], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4", "vector": [4, 7, 0.6059, 0.1412, 7, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/checkins':\n path = '../captures/api/v1/checkins.xml'\n elif url.path == '/v1/cities':\n path = '../captures/api/v1/cities.xml'\n elif url.path == '/v1/switchcity':\n path = '../captures/api/v1/switchcity.xml'\n elif url.path == '/v1/tips':\n path = '../captures/api/v1/tips.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L47_C6", "label": "path =", "type": "assigned_variable", "loc": [47, 47], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4", "vector": [14, 8, 0.5529, 0.0118, 8, 0.04, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/checkins.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4", "label": "if", "type": "if", "loc": [48, 57], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4", "vector": [4, 8, 0.6176, 0.1176, 8, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/cities':\n path = '../captures/api/v1/cities.xml'\n elif url.path == '/v1/switchcity':\n path = '../captures/api/v1/switchcity.xml'\n elif url.path == '/v1/tips':\n path = '../captures/api/v1/tips.xml'\n elif url.path == '/v1/checkin':\n path = '../captures/api/v1/checkin.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L49_C6", "label": "path =", "type": "assigned_variable", "loc": [49, 49], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4", "vector": [14, 9, 0.5765, 0.0118, 9, 0.95, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/cities.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4", "label": "if", "type": "if", "loc": [50, 57], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4", "vector": [4, 9, 0.6294, 0.0941, 9, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/switchcity':\n path = '../captures/api/v1/switchcity.xml'\n elif url.path == '/v1/tips':\n path = '../captures/api/v1/tips.xml'\n elif url.path == '/v1/checkin':\n path = '../captures/api/v1/checkin.xml'\n elif url.path == '/history/12345.rss':\n path = '../captures/api/v1/feed.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L51_C6", "label": "path =", "type": "assigned_variable", "loc": [51, 51], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4", "vector": [14, 10, 0.6, 0.0118, 10, 0.62, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/switchcity.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4", "label": "if", "type": "if", "loc": [52, 57], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4", "vector": [4, 10, 0.6412, 0.0706, 10, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/tips':\n path = '../captures/api/v1/tips.xml'\n elif url.path == '/v1/checkin':\n path = '../captures/api/v1/checkin.xml'\n elif url.path == '/history/12345.rss':\n path = '../captures/api/v1/feed.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L53_C6", "label": "path =", "type": "assigned_variable", "loc": [53, 53], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4", "vector": [14, 11, 0.6235, 0.0118, 11, 0.42, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/tips.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4", "label": "if", "type": "if", "loc": [54, 57], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4", "vector": [4, 11, 0.6529, 0.0471, 11, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/v1/checkin':\n path = '../captures/api/v1/checkin.xml'\n elif url.path == '/history/12345.rss':\n path = '../captures/api/v1/feed.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L55_C6", "label": "path =", "type": "assigned_variable", "loc": [55, 55], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4", "vector": [14, 12, 0.6471, 0.0118, 12, 0.29, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/checkin.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L56_C4", "label": "if", "type": "if", "loc": [56, 57], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4", "vector": [4, 12, 0.6647, 0.0235, 12, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif url.path == '/history/12345.rss':\n path = '../captures/api/v1/feed.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L57_C6", "label": "path =", "type": "assigned_variable", "loc": [57, 57], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L56_C4", "vector": [14, 13, 0.6706, 0.0118, 13, 0.22, 0.0, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '../captures/api/v1/feed.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "label": "if", "type": "if", "loc": [59, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "vector": [4, 2, 0.7176, 0.0588, 2, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path is None:\n self.send_error(404)\n else:\n logging.warn('Using: %s' % path)\n return open(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L60_C6", "label": "send_error()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "vector": [8, 3, 0.7059, 0.0118, 3, 0.18, 0.0, 886, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_error", "arg_names": [], "import_names": [], "rhs_call_name": "send_error", "annotation": ""}, "snippet": " self.send_error(404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L62_C6", "label": "warn()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "vector": [8, 3, 0.7294, 0.0118, 3, 0.18, 0.5, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Using: %s' % path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "vector": [13, 3, 0.7412, 0.0118, 3, 0.18, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "label": "send_200", "type": "function", "loc": [65, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "vector": [2, 1, 0.7824, 0.0471, 1, 0.74, 1.0, 966, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "send_200", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send_200(self):\n self.send_response(200)\n self.send_header('Content-type', 'text/xml')\n self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L66_C4", "label": "send_response()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "vector": [8, 2, 0.7765, 0.0118, 2, 0.54, 0.0, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response(200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L67_C4", "label": "send_header()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "vector": [8, 2, 0.7882, 0.0118, 2, 0.54, 0.5, 81, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send_header", "arg_names": [], "import_names": [], "rhs_call_name": "send_header", "annotation": ""}, "snippet": " self.send_header('Content-type', 'text/xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L68_C4", "label": "end_headers()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "vector": [8, 2, 0.8, 0.0118, 2, 0.54, 1.0, 683, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_headers", "arg_names": [], "import_names": [], "rhs_call_name": "end_headers", "annotation": ""}, "snippet": " self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "label": "main", "type": "function", "loc": [71, 81], "level": 0, "parent": null, "vector": [2, 0, 0.8941, 0.1294, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) > 1:\n port = int(sys.argv[1])\n else:\n port = 8080\n server_address = ('0.0.0.0', port)\n httpd = BaseHTTPServer.HTTPServer(server_address, RequestHandler)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2", "label": "if", "type": "if", "loc": [72, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [4, 1, 0.8647, 0.0471, 1, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) > 1:\n port = int(sys.argv[1])\n else:\n port = 8080"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L73_C4", "label": "port = int()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2", "vector": [14, 2, 0.8588, 0.0118, 2, 0.94, 0.0, 308, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "port", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " port = int(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L75_C4", "label": "port =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2", "vector": [14, 2, 0.8824, 0.0118, 2, 0.94, 1.0, 308, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " port = 8080"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L76_C2", "label": "server_address =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [14, 1, 0.8941, 0.0118, 1, 0.23, 0.2, 816, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "server_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " server_address = ('0.0.0.0', port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L77_C2", "label": "httpd = HTTPServer()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [14, 1, 0.9059, 0.0118, 1, 0.23, 0.4, 471, 3, 2, 0, 0, 258, 10, 1], "semantic": {"name": "httpd", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " httpd = BaseHTTPServer.HTTPServer(server_address, RequestHandler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L79_C2", "label": "sa = getsockname()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [14, 1, 0.9294, 0.0118, 1, 0.23, 0.6, 756, 3, 0, 0, 0, 994, 10, 1], "semantic": {"name": "sa", "arg_names": [], "import_names": [], "rhs_call_name": "getsockname", "annotation": ""}, "snippet": " sa = httpd.socket.getsockname()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L80_C2", "label": "print()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [8, 1, 0.9412, 0.0118, 1, 0.23, 0.8, 535, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Serving HTTP on\", sa[0], \"port\", sa[1], \"...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L81_C2", "label": "serve_forever()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "vector": [8, 1, 0.9529, 0.0118, 1, 0.23, 1.0, 993, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "serve_forever", "arg_names": [], "import_names": [], "rhs_call_name": "serve_forever", "annotation": ""}, "snippet": " httpd.serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:If_L84_C0", "label": "if", "type": "if", "loc": [84, 85], "level": 0, "parent": null, "vector": [4, 0, 0.9941, 0.0235, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L85_C2", "label": "main()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_826:If_L84_C0", "vector": [8, 1, 1.0, 0.0118, 1, 0.79, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L17_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L37_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L41_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L43_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L45_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L47_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L49_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L51_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L55_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826:If_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_826:Expr_L85_C2"}] |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joelapenna.foursquare.error.FoursquareParseException;
import com.joelapenna.foursquare.types.%(type_name)s;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Auto-generated: %(timestamp)s
*
* @author Joe LaPenna (joe@joelapenna.com)
* @param <T>
*/
public class %(type_name)sParser extends AbstractParser<%(type_name)s> {
private static final Logger LOG = Logger.getLogger(%(type_name)sParser.class.getCanonicalName());
private static final boolean DEBUG = Foursquare.PARSER_DEBUG;
@Override
public %(type_name)s parseInner(XmlPullParser parser) throws XmlPullParserException, IOException,
FoursquareError, FoursquareParseException {
parser.require(XmlPullParser.START_TAG, null, null);
%(type_name)s %(top_node_name)s = new %(type_name)s();
while (parser.nextTag() == XmlPullParser.START_TAG) {
String name = parser.getName();
%(stanzas)s
} else {
// Consume something we don't understand.
if (DEBUG) LOG.log(Level.FINE, "Found tag that we don't recognize: " + name);
skipSubTree(parser);
}
}
return %(top_node_name)s;
}
}"""
BOOLEAN_STANZA = """\
} else if ("%(name)s".equals(name)) {
%(top_node_name)s.set%(camel_name)s(Boolean.valueOf(parser.nextText()));
"""
GROUP_STANZA = """\
} else if ("%(name)s".equals(name)) {
%(top_node_name)s.set%(camel_name)s(new GroupParser(new %(sub_parser_camel_case)s()).parse(parser));
"""
COMPLEX_STANZA = """\
} else if ("%(name)s".equals(name)) {
%(top_node_name)s.set%(camel_name)s(new %(parser_name)s().parse(parser));
"""
STANZA = """\
} else if ("%(name)s".equals(name)) {
%(top_node_name)s.set%(camel_name)s(parser.nextText());
"""
def main():
type_name, top_node_name, attributes = common.WalkNodesForAttributes(
sys.argv[1])
GenerateClass(type_name, top_node_name, attributes)
def GenerateClass(type_name, top_node_name, attributes):
"""generate it.
type_name: the type of object the parser returns
top_node_name: the name of the object the parser returns.
per common.WalkNodsForAttributes
"""
stanzas = []
for name in sorted(attributes):
typ, children = attributes[name]
replacements = Replacements(top_node_name, name, typ, children)
if typ == common.BOOLEAN:
stanzas.append(BOOLEAN_STANZA % replacements)
elif typ == common.GROUP:
stanzas.append(GROUP_STANZA % replacements)
elif typ in common.COMPLEX:
stanzas.append(COMPLEX_STANZA % replacements)
else:
stanzas.append(STANZA % replacements)
if stanzas:
# pop off the extranious } else for the first conditional stanza.
stanzas[0] = stanzas[0].replace('} else ', '', 1)
replacements = Replacements(top_node_name, name, typ, [None])
replacements['stanzas'] = '\n'.join(stanzas).strip()
print PARSER % replacements
def Replacements(top_node_name, name, typ, children):
# CameCaseClassName
type_name = ''.join([word.capitalize() for word in top_node_name.split('_')])
# CamelCaseClassName
camel_name = ''.join([word.capitalize() for word in name.split('_')])
# camelCaseLocalName
attribute_name = camel_name.lower().capitalize()
# mFieldName
field_name = 'm' + camel_name
if children[0]:
sub_parser_camel_case = children[0] + 'Parser'
else:
sub_parser_camel_case = (camel_name[:-1] + 'Parser')
return {
'type_name': type_name,
'name': name,
'top_node_name': top_node_name,
'camel_name': camel_name,
'parser_name': typ + 'Parser',
'attribute_name': attribute_name,
'field_name': field_name,
'typ': typ,
'timestamp': datetime.datetime.now(),
'sub_parser_camel_case': sub_parser_camel_case,
'sub_type': children[0]
}
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_827 | 42 | 149 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_827:Import_L3_C0", "label": "datetime import datetime", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0201, 0.0067, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Import_L4_C0", "label": "sys import sys", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0268, 0.0067, 0, 0.66, 0.0769, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Import_L5_C0", "label": "textwrap import textwrap", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0336, 0.0067, 0, 0.66, 0.1538, 641, 0, 1, 0, 0, 641, 0, 0], "semantic": {"name": "textwrap", "arg_names": [], "import_names": ["textwrap"], "rhs_call_name": "", "annotation": ""}, "snippet": "import textwrap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Import_L7_C0", "label": "common import common", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.047, 0.0067, 0, 0.66, 0.2308, 718, 0, 1, 0, 0, 718, 0, 0], "semantic": {"name": "common", "arg_names": [], "import_names": ["common"], "rhs_call_name": "", "annotation": ""}, "snippet": "import common"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:ImportFrom_L9_C0", "label": "from xml.dom import pulldom", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0604, 0.0067, 0, 0.66, 0.3077, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["pulldom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import pulldom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L11_C0", "label": "PARSER =", "type": "assigned_variable", "loc": [11, 59], "level": 0, "parent": null, "vector": [14, 0, 0.2349, 0.3289, 0, 0.66, 0.3846, 92, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PARSER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L61_C0", "label": "BOOLEAN_STANZA =", "type": "assigned_variable", "loc": [61, 64], "level": 0, "parent": null, "vector": [14, 0, 0.4195, 0.0268, 0, 0.66, 0.4615, 839, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOOLEAN_STANZA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BOOLEAN_STANZA = \"\"\"\\\n } else if (\"%(name)s\".equals(name)) {\n %(top_node_name)s.set%(camel_name)s(Boolean.valueOf(parser.nextText()));\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L66_C0", "label": "GROUP_STANZA =", "type": "assigned_variable", "loc": [66, 69], "level": 0, "parent": null, "vector": [14, 0, 0.453, 0.0268, 0, 0.66, 0.5385, 306, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "GROUP_STANZA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GROUP_STANZA = \"\"\"\\\n } else if (\"%(name)s\".equals(name)) {\n %(top_node_name)s.set%(camel_name)s(new GroupParser(new %(sub_parser_camel_case)s()).parse(parser));\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L71_C0", "label": "COMPLEX_STANZA =", "type": "assigned_variable", "loc": [71, 74], "level": 0, "parent": null, "vector": [14, 0, 0.4866, 0.0268, 0, 0.66, 0.6154, 61, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COMPLEX_STANZA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMPLEX_STANZA = \"\"\"\\\n } else if (\"%(name)s\".equals(name)) {\n %(top_node_name)s.set%(camel_name)s(new %(parser_name)s().parse(parser));\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L76_C0", "label": "STANZA =", "type": "assigned_variable", "loc": [76, 79], "level": 0, "parent": null, "vector": [14, 0, 0.5201, 0.0268, 0, 0.66, 0.6923, 276, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STANZA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STANZA = \"\"\"\\\n } else if (\"%(name)s\".equals(name)) {\n %(top_node_name)s.set%(camel_name)s(parser.nextText());\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "label": "main", "type": "function", "loc": [82, 85], "level": 0, "parent": null, "vector": [2, 0, 0.5604, 0.0268, 0, 0.66, 0.7692, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n type_name, top_node_name, attributes = common.WalkNodesForAttributes(\n sys.argv[1])\n GenerateClass(type_name, top_node_name, attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L83_C2", "label": "type_name, top_node_name, attributes = WalkNodesForAttributes()", "type": "assigned_variable", "loc": [83, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "vector": [14, 1, 0.5604, 0.0134, 1, 0.68, 0.0, 244, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "type_name, top_node_name, attributes", "arg_names": [], "import_names": [], "rhs_call_name": "WalkNodesForAttributes", "annotation": ""}, "snippet": " type_name, top_node_name, attributes = common.WalkNodesForAttributes(\n sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L85_C2", "label": "GenerateClass()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "vector": [8, 1, 0.5705, 0.0067, 1, 0.68, 1.0, 578, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "GenerateClass", "arg_names": [], "import_names": [], "rhs_call_name": "GenerateClass", "annotation": ""}, "snippet": " GenerateClass(type_name, top_node_name, attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "label": "GenerateClass", "type": "function", "loc": [88, 115], "level": 0, "parent": null, "vector": [2, 0, 0.6812, 0.1879, 0, 0.66, 0.8462, 578, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "GenerateClass", "arg_names": ["type_name", "top_node_name", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GenerateClass(type_name, top_node_name, attributes):\n \"\"\"generate it.\n type_name: the type of object the parser returns\n top_node_name: the name of the object the parser returns.\n per common.WalkNodsForAttributes\n \"\"\"\n stanzas = []\n for name in sorted(attributes):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L89_C2", "label": "expression", "type": "expression", "loc": [89, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [8, 1, 0.6107, 0.0336, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"generate it.\n type_name: the type of object the parser returns\n top_node_name: the name of the object the parser returns.\n per common.WalkNodsForAttributes\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L94_C2", "label": "stanzas =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [14, 1, 0.6309, 0.0067, 1, 0.75, 0.1667, 232, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "stanzas", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stanzas = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "label": "for name", "type": "for", "loc": [95, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [6, 1, 0.6812, 0.094, 1, 0.75, 0.3333, 57, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in sorted(attributes):\n typ, children = attributes[name]\n replacements = Replacements(top_node_name, name, typ, children)\n if typ == common.BOOLEAN:\n stanzas.append(BOOLEAN_STANZA % replacements)\n\n elif typ == common.GROUP:\n stanzas.append(GROUP_STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L96_C4", "label": "typ, children =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "vector": [14, 2, 0.6443, 0.0067, 2, 0.29, 0.0, 844, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "typ, children", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " typ, children = attributes[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L97_C4", "label": "replacements = Replacements()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "vector": [14, 2, 0.651, 0.0067, 2, 0.29, 0.5, 403, 3, 4, 0, 0, 695, 10, 1], "semantic": {"name": "replacements", "arg_names": [], "import_names": [], "rhs_call_name": "Replacements", "annotation": ""}, "snippet": " replacements = Replacements(top_node_name, name, typ, children)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4", "label": "if", "type": "if", "loc": [98, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "vector": [4, 2, 0.6913, 0.0738, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == common.BOOLEAN:\n stanzas.append(BOOLEAN_STANZA % replacements)\n\n elif typ == common.GROUP:\n stanzas.append(GROUP_STANZA % replacements)\n\n elif typ in common.COMPLEX:\n stanzas.append(COMPLEX_STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L99_C6", "label": "append()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4", "vector": [8, 3, 0.6644, 0.0067, 3, 0.57, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stanzas.append(BOOLEAN_STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4", "label": "if", "type": "if", "loc": [101, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4", "vector": [4, 3, 0.7013, 0.0537, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif typ == common.GROUP:\n stanzas.append(GROUP_STANZA % replacements)\n\n elif typ in common.COMPLEX:\n stanzas.append(COMPLEX_STANZA % replacements)\n\n else:\n stanzas.append(STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L102_C6", "label": "append()", "type": "expression", "loc": [102, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4", "vector": [8, 4, 0.6846, 0.0067, 4, 0.81, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stanzas.append(GROUP_STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4", "label": "if", "type": "if", "loc": [104, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4", "vector": [4, 4, 0.7114, 0.0336, 4, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif typ in common.COMPLEX:\n stanzas.append(COMPLEX_STANZA % replacements)\n\n else:\n stanzas.append(STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L105_C6", "label": "append()", "type": "expression", "loc": [105, 105], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4", "vector": [8, 5, 0.7047, 0.0067, 5, 0.49, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stanzas.append(COMPLEX_STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L108_C6", "label": "append()", "type": "expression", "loc": [108, 108], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4", "vector": [8, 5, 0.7248, 0.0067, 5, 0.49, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stanzas.append(STANZA % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L109_C2", "label": "if", "type": "if", "loc": [109, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [4, 1, 0.7383, 0.0201, 1, 0.75, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if stanzas:\n # pop off the extranious } else for the first conditional stanza.\n stanzas[0] = stanzas[0].replace('} else ', '', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L111_C4", "label": " = replace()", "type": "assigned_variable", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L109_C2", "vector": [14, 2, 0.745, 0.0067, 2, 0.24, 0.0, 0, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " stanzas[0] = stanzas[0].replace('} else ', '', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L113_C2", "label": "replacements = Replacements()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [14, 1, 0.7584, 0.0067, 1, 0.75, 0.6667, 403, 3, 4, 0, 0, 695, 10, 1], "semantic": {"name": "replacements", "arg_names": [], "import_names": [], "rhs_call_name": "Replacements", "annotation": ""}, "snippet": " replacements = Replacements(top_node_name, name, typ, [None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L114_C2", "label": " = strip()", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [14, 1, 0.7651, 0.0067, 1, 0.75, 0.8333, 0, 3, 0, 0, 0, 973, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " replacements['stanzas'] = '\\n'.join(stanzas).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L115_C2", "label": "print()", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "vector": [8, 1, 0.7718, 0.0067, 1, 0.75, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(PARSER % replacements)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "label": "Replacements", "type": "function", "loc": [118, 145], "level": 0, "parent": null, "vector": [2, 0, 0.8826, 0.1879, 0, 0.66, 0.9231, 695, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "Replacements", "arg_names": ["top_node_name", "name", "typ", "children"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Replacements(top_node_name, name, typ, children):\n # CameCaseClassName\n type_name = ''.join([word.capitalize() for word in top_node_name.split('_')])\n # CamelCaseClassName\n camel_name = ''.join([word.capitalize() for word in name.split('_')])\n # camelCaseLocalName\n attribute_name = camel_name.lower().capitalize()\n # mFieldName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L120_C2", "label": "type_name = join()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [14, 1, 0.8054, 0.0067, 1, 0.27, 0.0, 81, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "type_name", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " type_name = ''.join([word.capitalize() for word in top_node_name.split('_')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L122_C2", "label": "camel_name = join()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [14, 1, 0.8188, 0.0067, 1, 0.27, 0.2, 510, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "camel_name", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " camel_name = ''.join([word.capitalize() for word in name.split('_')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L124_C2", "label": "attribute_name = capitalize()", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [14, 1, 0.8322, 0.0067, 1, 0.27, 0.4, 592, 3, 0, 0, 0, 353, 10, 2], "semantic": {"name": "attribute_name", "arg_names": [], "import_names": [], "rhs_call_name": "capitalize", "annotation": ""}, "snippet": " attribute_name = camel_name.lower().capitalize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L126_C2", "label": "field_name =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [14, 1, 0.8456, 0.0067, 1, 0.27, 0.6, 918, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field_name = 'm' + camel_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2", "label": "if", "type": "if", "loc": [128, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [4, 1, 0.8691, 0.0268, 1, 0.27, 0.8, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if children[0]:\n sub_parser_camel_case = children[0] + 'Parser'\n else:\n sub_parser_camel_case = (camel_name[:-1] + 'Parser')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L129_C4", "label": "sub_parser_camel_case =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2", "vector": [14, 2, 0.8658, 0.0067, 2, 0.78, 0.0, 187, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sub_parser_camel_case", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sub_parser_camel_case = children[0] + 'Parser'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L131_C4", "label": "sub_parser_camel_case =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2", "vector": [14, 2, 0.8792, 0.0067, 2, 0.78, 1.0, 187, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sub_parser_camel_case", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sub_parser_camel_case = (camel_name[:-1] + 'Parser')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Return_L133_C2", "label": "return", "type": "return", "loc": [133, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "vector": [13, 1, 0.9329, 0.0872, 1, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {\n 'type_name': type_name,\n 'name': name,\n 'top_node_name': top_node_name,\n 'camel_name': camel_name,\n 'parser_name': typ + 'Parser',\n 'attribute_name': attribute_name,\n 'field_name': field_name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:If_L148_C0", "label": "if", "type": "if", "loc": [148, 149], "level": 0, "parent": null, "vector": [4, 0, 0.9966, 0.0134, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L149_C2", "label": "main()", "type": "expression", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_827:If_L148_C0", "vector": [8, 1, 1.0, 0.0067, 1, 0.06, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:For_L95_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L99_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L102_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:If_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L109_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:FunctionDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Return_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_827:If_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_827:Expr_L149_C2"}] |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.dom import pulldom
from xml.dom import minidom
import oauth
"""From: http://groups.google.com/group/foursquare-api/web/oauth
@consumer = OAuth::Consumer.new("consumer_token","consumer_secret", {
:site => "http://foursquare.com",
:scheme => :header,
:http_method => :post,
:request_token_path => "/oauth/request_token",
:access_token_path => "/oauth/access_token",
:authorize_path => "/oauth/authorize"
})
"""
SERVER = 'api.foursquare.com:80'
CONTENT_TYPE_HEADER = {'Content-Type' :'application/x-www-form-urlencoded'}
SIGNATURE_METHOD = oauth.OAuthSignatureMethod_HMAC_SHA1()
AUTHEXCHANGE_URL = 'http://api.foursquare.com/v1/authexchange'
def parse_auth_response(auth_response):
return (
re.search('<oauth_token>(.*)</oauth_token>', auth_response).groups()[0],
re.search('<oauth_token_secret>(.*)</oauth_token_secret>',
auth_response).groups()[0]
)
def create_signed_oauth_request(username, password, consumer):
oauth_request = oauth.OAuthRequest.from_consumer_and_token(
consumer, http_method='POST', http_url=AUTHEXCHANGE_URL,
parameters=dict(fs_username=username, fs_password=password))
oauth_request.sign_request(SIGNATURE_METHOD, consumer, None)
return oauth_request
def main():
url = urlparse.urlparse(sys.argv[1])
# Nevermind that the query can have repeated keys.
parameters = dict(urlparse.parse_qsl(url.query))
password_file = open(os.path.join(user.home, '.oget'))
lines = [line.strip() for line in password_file.readlines()]
if len(lines) == 4:
cons_key, cons_key_secret, username, password = lines
access_token = None
else:
cons_key, cons_key_secret, username, password, token, secret = lines
access_token = oauth.OAuthToken(token, secret)
consumer = oauth.OAuthConsumer(cons_key, cons_key_secret)
if not access_token:
oauth_request = create_signed_oauth_request(username, password, consumer)
connection = httplib.HTTPConnection(SERVER)
headers = {'Content-Type' :'application/x-www-form-urlencoded'}
connection.request(oauth_request.http_method, AUTHEXCHANGE_URL,
body=oauth_request.to_postdata(), headers=headers)
auth_response = connection.getresponse().read()
token = parse_auth_response(auth_response)
access_token = oauth.OAuthToken(*token)
open(os.path.join(user.home, '.oget'), 'w').write('\n'.join((
cons_key, cons_key_secret, username, password, token[0], token[1])))
oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer,
access_token, http_method='POST', http_url=url.geturl(),
parameters=parameters)
oauth_request.sign_request(SIGNATURE_METHOD, consumer, access_token)
connection = httplib.HTTPConnection(SERVER)
connection.request(oauth_request.http_method, oauth_request.to_url(),
body=oauth_request.to_postdata(), headers=CONTENT_TYPE_HEADER)
print connection.getresponse().read()
#print minidom.parse(connection.getresponse()).toprettyxml(indent=' ')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_828 | 50 | 111 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0631, 0.0991, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L14_C0", "label": "httplib import httplib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1261, 0.009, 0, 0.66, 0.05, 2, 0, 1, 0, 0, 2, 0, 0], "semantic": {"name": "httplib", "arg_names": [], "import_names": ["httplib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import httplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L15_C0", "label": "os import os", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1351, 0.009, 0, 0.66, 0.1, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L16_C0", "label": "re import re", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1441, 0.009, 0, 0.66, 0.15, 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_828:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1532, 0.009, 0, 0.66, 0.2, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L18_C0", "label": "urllib import urllib", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1622, 0.009, 0, 0.66, 0.25, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L19_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1712, 0.009, 0, 0.66, 0.3, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L20_C0", "label": "urlparse import urlparse", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1802, 0.009, 0, 0.66, 0.35, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L21_C0", "label": "user import user", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1892, 0.009, 0, 0.66, 0.4, 503, 0, 1, 0, 0, 503, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": ["user"], "rhs_call_name": "", "annotation": ""}, "snippet": "import user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:ImportFrom_L22_C0", "label": "from xml.dom import pulldom", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1982, 0.009, 0, 0.66, 0.45, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["pulldom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import pulldom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:ImportFrom_L23_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2072, 0.009, 0, 0.66, 0.5, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["minidom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import minidom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Import_L25_C0", "label": "oauth import oauth", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.2252, 0.009, 0, 0.66, 0.55, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "oauth", "arg_names": [], "import_names": ["oauth"], "rhs_call_name": "", "annotation": ""}, "snippet": "import oauth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L27_C0", "label": "expression", "type": "expression", "loc": [27, 37], "level": 0, "parent": null, "vector": [8, 0, 0.2883, 0.0991, 0, 0.66, 0.6, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"From: http://groups.google.com/group/foursquare-api/web/oauth\n\n@consumer = OAuth::Consumer.new(\"consumer_token\",\"consumer_secret\", {\n :site => \"http://foursquare.com\",\n :scheme => :header,\n :http_method => :post,\n :request_token_path => \"/oauth/request_token\",\n :access_token_path => \"/oauth/access_token\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L39_C0", "label": "SERVER =", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.3514, 0.009, 0, 0.66, 0.65, 784, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SERVER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SERVER = 'api.foursquare.com:80'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L41_C0", "label": "CONTENT_TYPE_HEADER =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.3694, 0.009, 0, 0.66, 0.7, 415, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CONTENT_TYPE_HEADER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CONTENT_TYPE_HEADER = {'Content-Type' :'application/x-www-form-urlencoded'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L43_C0", "label": "SIGNATURE_METHOD = OAuthSignatureMethod_HMAC_SHA1()", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.3874, 0.009, 0, 0.66, 0.75, 339, 3, 0, 0, 0, 605, 10, 1], "semantic": {"name": "SIGNATURE_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthSignatureMethod_HMAC_SHA1", "annotation": ""}, "snippet": "SIGNATURE_METHOD = oauth.OAuthSignatureMethod_HMAC_SHA1()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L45_C0", "label": "AUTHEXCHANGE_URL =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.4054, 0.009, 0, 0.66, 0.8, 898, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUTHEXCHANGE_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUTHEXCHANGE_URL = 'http://api.foursquare.com/v1/authexchange'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L48_C0", "label": "parse_auth_response", "type": "function", "loc": [48, 53], "level": 0, "parent": null, "vector": [2, 0, 0.455, 0.0541, 0, 0.66, 0.85, 168, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "parse_auth_response", "arg_names": ["auth_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_auth_response(auth_response):\n return (\n re.search('<oauth_token>(.*)</oauth_token>', auth_response).groups()[0],\n re.search('<oauth_token_secret>(.*)</oauth_token_secret>',\n auth_response).groups()[0]\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Return_L49_C2", "label": "return", "type": "return", "loc": [49, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L48_C0", "vector": [13, 1, 0.4595, 0.045, 1, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 8, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (\n re.search('<oauth_token>(.*)</oauth_token>', auth_response).groups()[0],\n re.search('<oauth_token_secret>(.*)</oauth_token_secret>',\n auth_response).groups()[0]\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "label": "create_signed_oauth_request", "type": "function", "loc": [56, 62], "level": 0, "parent": null, "vector": [2, 0, 0.5315, 0.0631, 0, 0.66, 0.9, 448, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "create_signed_oauth_request", "arg_names": ["username", "password", "consumer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_signed_oauth_request(username, password, consumer):\n oauth_request = oauth.OAuthRequest.from_consumer_and_token(\n consumer, http_method='POST', http_url=AUTHEXCHANGE_URL,\n parameters=dict(fs_username=username, fs_password=password))\n\n oauth_request.sign_request(SIGNATURE_METHOD, consumer, None)\n return oauth_request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L57_C2", "label": "oauth_request = from_consumer_and_token()", "type": "assigned_variable", "loc": [57, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "vector": [14, 1, 0.5225, 0.027, 1, 0.7, 0.0, 1, 3, 4, 0, 0, 319, 10, 2], "semantic": {"name": "oauth_request", "arg_names": [], "import_names": [], "rhs_call_name": "from_consumer_and_token", "annotation": ""}, "snippet": " oauth_request = oauth.OAuthRequest.from_consumer_and_token(\n consumer, http_method='POST', http_url=AUTHEXCHANGE_URL,\n parameters=dict(fs_username=username, fs_password=password))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L61_C2", "label": "sign_request()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "vector": [8, 1, 0.5495, 0.009, 1, 0.7, 0.5, 817, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "sign_request", "arg_names": [], "import_names": [], "rhs_call_name": "sign_request", "annotation": ""}, "snippet": " oauth_request.sign_request(SIGNATURE_METHOD, consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "vector": [13, 1, 0.5586, 0.009, 1, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return oauth_request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 106], "level": 0, "parent": null, "vector": [2, 0, 0.7703, 0.3784, 0, 0.66, 0.95, 624, 0, 0, 0, 0, 0, 0, 32], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n url = urlparse.urlparse(sys.argv[1])\n # Nevermind that the query can have repeated keys.\n parameters = dict(urlparse.parse_qsl(url.query))\n\n password_file = open(os.path.join(user.home, '.oget'))\n lines = [line.strip() for line in password_file.readlines()]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L66_C2", "label": "url = urlparse()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.5946, 0.009, 1, 0.59, 0.0, 789, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " url = urlparse.urlparse(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L68_C2", "label": "parameters = dict()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.6126, 0.009, 1, 0.59, 0.0909, 29, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " parameters = dict(urlparse.parse_qsl(url.query))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L70_C2", "label": "password_file = open()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.6306, 0.009, 1, 0.59, 0.1818, 18, 3, 1, 0, 0, 693, 10, 2], "semantic": {"name": "password_file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " password_file = open(os.path.join(user.home, '.oget'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L71_C2", "label": "lines =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.6396, 0.009, 1, 0.59, 0.2727, 73, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lines = [line.strip() for line in password_file.readlines()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "label": "if", "type": "if", "loc": [73, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [4, 1, 0.6802, 0.0541, 1, 0.59, 0.3636, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(lines) == 4:\n cons_key, cons_key_secret, username, password = lines\n access_token = None\n else:\n cons_key, cons_key_secret, username, password, token, secret = lines\n access_token = oauth.OAuthToken(token, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L74_C4", "label": "cons_key, cons_key_secret, username, password =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "vector": [14, 2, 0.6667, 0.009, 2, 0.51, 0.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cons_key, cons_key_secret, username, password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cons_key, cons_key_secret, username, password = lines"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L75_C4", "label": "access_token =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "vector": [14, 2, 0.6757, 0.009, 2, 0.51, 0.3333, 797, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L77_C4", "label": "cons_key, cons_key_secret, username, password, token, secret =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "vector": [14, 2, 0.6937, 0.009, 2, 0.51, 0.6667, 616, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cons_key, cons_key_secret, username, password, token, secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cons_key, cons_key_secret, username, password, token, secret = lines"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L78_C4", "label": "access_token = OAuthToken()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "vector": [14, 2, 0.7027, 0.009, 2, 0.51, 1.0, 797, 3, 2, 0, 0, 512, 10, 1], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthToken", "annotation": ""}, "snippet": " access_token = oauth.OAuthToken(token, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L80_C2", "label": "consumer = OAuthConsumer()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.7207, 0.009, 1, 0.59, 0.4545, 352, 3, 2, 0, 0, 660, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthConsumer", "annotation": ""}, "snippet": " consumer = oauth.OAuthConsumer(cons_key, cons_key_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "label": "if", "type": "if", "loc": [82, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [4, 1, 0.7973, 0.1261, 1, 0.59, 0.5455, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not access_token:\n oauth_request = create_signed_oauth_request(username, password, consumer)\n\n connection = httplib.HTTPConnection(SERVER)\n\n headers = {'Content-Type' :'application/x-www-form-urlencoded'}\n connection.request(oauth_request.http_method, AUTHEXCHANGE_URL,\n body=oauth_request.to_postdata(), headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L83_C4", "label": "oauth_request = create_signed_oauth_request()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.7477, 0.009, 2, 0.29, 0.0, 1, 3, 3, 0, 0, 448, 10, 1], "semantic": {"name": "oauth_request", "arg_names": [], "import_names": [], "rhs_call_name": "create_signed_oauth_request", "annotation": ""}, "snippet": " oauth_request = create_signed_oauth_request(username, password, consumer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L85_C4", "label": "connection = HTTPConnection()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.7658, 0.009, 2, 0.29, 0.1429, 351, 3, 1, 0, 0, 29, 10, 1], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPConnection", "annotation": ""}, "snippet": " connection = httplib.HTTPConnection(SERVER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L87_C4", "label": "headers =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.7838, 0.009, 2, 0.29, 0.2857, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {'Content-Type' :'application/x-www-form-urlencoded'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L88_C4", "label": "request()", "type": "expression", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [8, 2, 0.7973, 0.018, 2, 0.29, 0.4286, 50, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " connection.request(oauth_request.http_method, AUTHEXCHANGE_URL,\n body=oauth_request.to_postdata(), headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L91_C4", "label": "auth_response = read()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.8198, 0.009, 2, 0.29, 0.5714, 446, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "auth_response", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " auth_response = connection.getresponse().read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L92_C4", "label": "token = parse_auth_response()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.8288, 0.009, 2, 0.29, 0.7143, 129, 3, 1, 0, 0, 168, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "parse_auth_response", "annotation": ""}, "snippet": " token = parse_auth_response(auth_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L93_C4", "label": "access_token = OAuthToken()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [14, 2, 0.8378, 0.009, 2, 0.29, 0.8571, 797, 3, 1, 0, 0, 512, 10, 1], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "OAuthToken", "annotation": ""}, "snippet": " access_token = oauth.OAuthToken(*token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L94_C4", "label": "write()", "type": "expression", "loc": [94, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "vector": [8, 2, 0.8514, 0.018, 2, 0.29, 1.0, 837, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " open(os.path.join(user.home, '.oget'), 'w').write('\\n'.join((\n cons_key, cons_key_secret, username, password, token[0], token[1])))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L97_C2", "label": "oauth_request = from_consumer_and_token()", "type": "assigned_variable", "loc": [97, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.8829, 0.027, 1, 0.59, 0.6364, 1, 3, 5, 0, 0, 319, 10, 2], "semantic": {"name": "oauth_request", "arg_names": [], "import_names": [], "rhs_call_name": "from_consumer_and_token", "annotation": ""}, "snippet": " oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer,\n access_token, http_method='POST', http_url=url.geturl(),\n parameters=parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L100_C2", "label": "sign_request()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [8, 1, 0.9009, 0.009, 1, 0.59, 0.7273, 817, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "sign_request", "arg_names": [], "import_names": [], "rhs_call_name": "sign_request", "annotation": ""}, "snippet": " oauth_request.sign_request(SIGNATURE_METHOD, consumer, access_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L102_C2", "label": "connection = HTTPConnection()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [14, 1, 0.9189, 0.009, 1, 0.59, 0.8182, 351, 3, 1, 0, 0, 29, 10, 1], "semantic": {"name": "connection", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPConnection", "annotation": ""}, "snippet": " connection = httplib.HTTPConnection(SERVER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L103_C2", "label": "request()", "type": "expression", "loc": [103, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [8, 1, 0.9324, 0.018, 1, 0.59, 0.9091, 50, 3, 4, 0, 0, 0, 0, 3], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " connection.request(oauth_request.http_method, oauth_request.to_url(),\n body=oauth_request.to_postdata(), headers=CONTENT_TYPE_HEADER)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L106_C2", "label": "print()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "vector": [8, 1, 0.955, 0.009, 1, 0.59, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(connection.getresponse().read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:If_L110_C0", "label": "if", "type": "if", "loc": [110, 111], "level": 0, "parent": null, "vector": [4, 0, 0.9955, 0.018, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L111_C2", "label": "main()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_828:If_L110_C0", "vector": [8, 1, 1.0, 0.009, 1, 0.47, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Return_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_828:If_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_828:Expr_L111_C2"}] |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basename.split('_')])
fullpath = os.path.join(TYPESDIR, f)
typepath = os.path.join(BASEDIR, 'types', javaname + '.java')
parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java')
cmd = 'python gen_class.py %s > %s' % (fullpath, typepath)
print cmd
subprocess.call(cmd, stdout=sys.stdout, shell=True)
cmd = 'python gen_parser.py %s > %s' % (fullpath, parserpath)
print cmd
subprocess.call(cmd, stdout=sys.stdout, shell=True)
| ajibawa-2023/Python-Code-Large/train/row_829 | 20 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_829:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Import_L4_C0", "label": "subprocess import subprocess", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.1429, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.037, 0, 0.66, 0.2857, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L7_C0", "label": "BASEDIR =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.2593, 0.037, 0, 0.66, 0.4286, 914, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BASEDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BASEDIR = '../main/src/com/joelapenna/foursquare'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L8_C0", "label": "TYPESDIR =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2963, 0.037, 0, 0.66, 0.5714, 369, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPESDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TYPESDIR = '../captures/types/v1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L10_C0", "label": "captures =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3704, 0.037, 0, 0.66, 0.7143, 890, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "captures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "captures = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:If_L11_C0", "label": "if", "type": "if", "loc": [11, 12], "level": 0, "parent": null, "vector": [4, 0, 0.4259, 0.0741, 0, 0.66, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not captures:\n captures = os.listdir(TYPESDIR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L12_C2", "label": "captures = listdir()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:If_L11_C0", "vector": [14, 1, 0.4444, 0.037, 1, 0.93, 0.0, 890, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "captures", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " captures = os.listdir(TYPESDIR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "label": "for f", "type": "for", "loc": [14, 27], "level": 0, "parent": null, "vector": [6, 0, 0.7593, 0.5185, 0, 0.66, 1.0, 899, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for f in captures:\n basename = f.split('.')[0]\n javaname = ''.join([c.capitalize() for c in basename.split('_')])\n fullpath = os.path.join(TYPESDIR, f)\n typepath = os.path.join(BASEDIR, 'types', javaname + '.java')\n parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java')\n\n cmd = 'python gen_class.py %s > %s' % (fullpath, typepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L15_C2", "label": "basename =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.5556, 0.037, 1, 0.93, 0.0, 164, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "basename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " basename = f.split('.')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L16_C2", "label": "javaname = join()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.5926, 0.037, 1, 0.93, 0.1, 554, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "javaname", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " javaname = ''.join([c.capitalize() for c in basename.split('_')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L17_C2", "label": "fullpath = join()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.6296, 0.037, 1, 0.93, 0.2, 858, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "fullpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " fullpath = os.path.join(TYPESDIR, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L18_C2", "label": "typepath = join()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.6667, 0.037, 1, 0.93, 0.3, 428, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "typepath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " typepath = os.path.join(BASEDIR, 'types', javaname + '.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L19_C2", "label": "parserpath = join()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.7037, 0.037, 1, 0.93, 0.4, 114, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "parserpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L21_C2", "label": "cmd =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.7778, 0.037, 1, 0.93, 0.5, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'python gen_class.py %s > %s' % (fullpath, typepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L22_C2", "label": "print()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [8, 1, 0.8148, 0.037, 1, 0.93, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L23_C2", "label": "call()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [8, 1, 0.8519, 0.037, 1, 0.93, 0.7, 832, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " subprocess.call(cmd, stdout=sys.stdout, shell=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L25_C2", "label": "cmd =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [14, 1, 0.9259, 0.037, 1, 0.93, 0.8, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'python gen_parser.py %s > %s' % (fullpath, parserpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L26_C2", "label": "print()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [8, 1, 0.963, 0.037, 1, 0.93, 0.9, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L27_C2", "label": "call()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "vector": [8, 1, 1.0, 0.037, 1, 0.93, 1.0, 832, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " subprocess.call(cmd, stdout=sys.stdout, shell=True)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_829:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_829:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_829:Expr_L27_C2"}] |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLASS_IMPORTS = [
]
CLASS_IMPORTS = {
# 'Checkin': DEFAULT_CLASS_IMPORTS + [
# 'import com.joelapenna.foursquare.filters.VenueFilterable'
# ],
# 'Venue': DEFAULT_CLASS_IMPORTS + [
# 'import com.joelapenna.foursquare.filters.VenueFilterable'
# ],
# 'Tip': DEFAULT_CLASS_IMPORTS + [
# 'import com.joelapenna.foursquare.filters.VenueFilterable'
# ],
}
COMPLEX = [
'Group',
'Badge',
'Beenhere',
'Checkin',
'CheckinResponse',
'City',
'Credentials',
'Data',
'Mayor',
'Rank',
'Score',
'Scoring',
'Settings',
'Stats',
'Tags',
'Tip',
'User',
'Venue',
]
TYPES = COMPLEX + ['boolean']
def WalkNodesForAttributes(path):
"""Parse the xml file getting all attributes.
<venue>
<attribute>value</attribute>
</venue>
Returns:
type_name - The java-style name the top node will have. "Venue"
top_node_name - unadultured name of the xml stanza, probably the type of
java class we're creating. "venue"
attributes - {'attribute': 'value'}
"""
doc = pulldom.parse(path)
type_name = None
top_node_name = None
attributes = {}
level = 0
for event, node in doc:
# For skipping parts of a tree.
if level > 0:
if event == pulldom.END_ELEMENT:
level-=1
logging.warn('(%s) Skip end: %s' % (str(level), node))
continue
elif event == pulldom.START_ELEMENT:
logging.warn('(%s) Skipping: %s' % (str(level), node))
level+=1
continue
if event == pulldom.START_ELEMENT:
logging.warn('Parsing: ' + node.tagName)
# Get the type name to use.
if type_name is None:
type_name = ''.join([word.capitalize()
for word in node.tagName.split('_')])
top_node_name = node.tagName
logging.warn('Found Top Node Name: ' + top_node_name)
continue
typ = node.getAttribute('type')
child = node.getAttribute('child')
# We don't want to walk complex types.
if typ in COMPLEX:
logging.warn('Found Complex: ' + node.tagName)
level = 1
elif typ not in TYPES:
logging.warn('Found String: ' + typ)
typ = STRING
else:
logging.warn('Found Type: ' + typ)
logging.warn('Adding: ' + str((node, typ)))
attributes.setdefault(node.tagName, (typ, [child]))
logging.warn('Attr: ' + str((type_name, top_node_name, attributes)))
return type_name, top_node_name, attributes
| ajibawa-2023/Python-Code-Large/train/row_830 | 44 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_830:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0088, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:ImportFrom_L5_C0", "label": "from xml.dom import minidom", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0439, 0.0088, 0, 0.66, 0.0833, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["minidom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import minidom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:ImportFrom_L6_C0", "label": "from xml.dom import pulldom", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0088, 0, 0.66, 0.1667, 290, 0, 1, 0, 0, 290, 0, 0], "semantic": {"name": "xml.dom", "arg_names": [], "import_names": ["pulldom"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.dom import pulldom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L8_C0", "label": "BOOLEAN =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0702, 0.0088, 0, 0.66, 0.25, 310, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BOOLEAN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BOOLEAN = \"boolean\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L9_C0", "label": "STRING =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0789, 0.0088, 0, 0.66, 0.3333, 560, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STRING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STRING = \"String\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L10_C0", "label": "GROUP =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.0877, 0.0088, 0, 0.66, 0.4167, 39, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "GROUP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GROUP = \"Group\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L14_C0", "label": "DEFAULT_INTERFACES =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.1228, 0.0088, 0, 0.66, 0.5, 228, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "DEFAULT_INTERFACES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_INTERFACES = ['FoursquareType']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L17_C0", "label": "INTERFACES =", "type": "assigned_variable", "loc": [17, 18], "level": 0, "parent": null, "vector": [14, 0, 0.1535, 0.0175, 0, 0.66, 0.5833, 296, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "INTERFACES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INTERFACES = {\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L20_C0", "label": "DEFAULT_CLASS_IMPORTS =", "type": "assigned_variable", "loc": [20, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1798, 0.0175, 0, 0.66, 0.6667, 786, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "DEFAULT_CLASS_IMPORTS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_CLASS_IMPORTS = [\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L23_C0", "label": "CLASS_IMPORTS =", "type": "assigned_variable", "loc": [23, 33], "level": 0, "parent": null, "vector": [14, 0, 0.2456, 0.0965, 0, 0.66, 0.75, 103, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CLASS_IMPORTS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMPORTS + [\n# 'import com.joelapenna.foursquare.filters.VenueFilterable'\n# ],\n# 'Venue': DEFAULT_CLASS_IMPORTS + [\n# 'import com.joelapenna.foursquare.filters.VenueFilterable'\n# ],\n# 'Tip': DEFAULT_CLASS_IMPORTS + ["}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L36_C0", "label": "COMPLEX =", "type": "assigned_variable", "loc": [36, 55], "level": 0, "parent": null, "vector": [14, 0, 0.3991, 0.1754, 0, 0.66, 0.8333, 78, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "COMPLEX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMPLEX = [\n 'Group',\n 'Badge',\n 'Beenhere',\n 'Checkin',\n 'CheckinResponse',\n 'City',\n 'Credentials',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L56_C0", "label": "TYPES =", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.4912, 0.0088, 0, 0.66, 0.9167, 493, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TYPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TYPES = COMPLEX + ['boolean']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "label": "WalkNodesForAttributes", "type": "function", "loc": [59, 114], "level": 0, "parent": null, "vector": [2, 0, 0.7588, 0.4912, 0, 0.66, 1.0, 612, 0, 1, 1, 0, 0, 0, 20], "semantic": {"name": "WalkNodesForAttributes", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def WalkNodesForAttributes(path):\n \"\"\"Parse the xml file getting all attributes.\n <venue>\n <attribute>value</attribute>\n </venue>\n\n Returns:\n type_name - The java-style name the top node will have. \"Venue\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [8, 1, 0.5702, 0.0965, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse the xml file getting all attributes.\n <venue>\n <attribute>value</attribute>\n </venue>\n\n Returns:\n type_name - The java-style name the top node will have. \"Venue\"\n top_node_name - unadultured name of the xml stanza, probably the type of"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L71_C2", "label": "doc = parse()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [14, 1, 0.6228, 0.0088, 1, 0.62, 0.125, 555, 3, 1, 0, 0, 678, 10, 1], "semantic": {"name": "doc", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " doc = pulldom.parse(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L73_C2", "label": "type_name =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [14, 1, 0.6404, 0.0088, 1, 0.62, 0.25, 81, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "type_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type_name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L74_C2", "label": "top_node_name =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [14, 1, 0.6491, 0.0088, 1, 0.62, 0.375, 238, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "top_node_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " top_node_name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L75_C2", "label": "attributes =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [14, 1, 0.6579, 0.0088, 1, 0.62, 0.5, 344, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "attributes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attributes = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L77_C2", "label": "level =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [14, 1, 0.6754, 0.0088, 1, 0.62, 0.625, 479, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " level = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2", "label": "for event, node", "type": "for", "loc": [78, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [6, 1, 0.8333, 0.307, 1, 0.62, 0.75, 207, 2, 0, 0, 0, 0, 0, 17], "semantic": {"name": "event, node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for event, node in doc:\n # For skipping parts of a tree.\n if level > 0:\n if event == pulldom.END_ELEMENT:\n level-=1\n logging.warn('(%s) Skip end: %s' % (str(level), node))\n continue\n elif event == pulldom.START_ELEMENT:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L80_C4", "label": "if", "type": "if", "loc": [80, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2", "vector": [4, 2, 0.7368, 0.0789, 2, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if level > 0:\n if event == pulldom.END_ELEMENT:\n level-=1\n logging.warn('(%s) Skip end: %s' % (str(level), node))\n continue\n elif event == pulldom.START_ELEMENT:\n logging.warn('(%s) Skipping: %s' % (str(level), node))\n level+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6", "label": "if", "type": "if", "loc": [81, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L80_C4", "vector": [4, 3, 0.7412, 0.0702, 3, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event == pulldom.END_ELEMENT:\n level-=1\n logging.warn('(%s) Skip end: %s' % (str(level), node))\n continue\n elif event == pulldom.START_ELEMENT:\n logging.warn('(%s) Skipping: %s' % (str(level), node))\n level+=1\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L83_C8", "label": "warn()", "type": "expression", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6", "vector": [8, 4, 0.7281, 0.0088, 4, 0.05, 0.0, 960, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('(%s) Skip end: %s' % (str(level), node))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L85_C6", "label": "if", "type": "if", "loc": [85, 88], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6", "vector": [4, 4, 0.7588, 0.0351, 4, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif event == pulldom.START_ELEMENT:\n logging.warn('(%s) Skipping: %s' % (str(level), node))\n level+=1\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L86_C8", "label": "warn()", "type": "expression", "loc": [86, 86], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L85_C6", "vector": [8, 5, 0.7544, 0.0088, 5, 0.16, 0.0, 960, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('(%s) Skipping: %s' % (str(level), node))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "label": "if", "type": "if", "loc": [90, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2", "vector": [4, 2, 0.886, 0.2018, 2, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event == pulldom.START_ELEMENT:\n logging.warn('Parsing: ' + node.tagName)\n # Get the type name to use.\n if type_name is None:\n type_name = ''.join([word.capitalize()\n for word in node.tagName.split('_')])\n top_node_name = node.tagName\n logging.warn('Found Top Node Name: ' + top_node_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L91_C6", "label": "warn()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [8, 3, 0.7982, 0.0088, 3, 0.22, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Parsing: ' + node.tagName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "label": "if", "type": "if", "loc": [93, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [4, 3, 0.8377, 0.0526, 3, 0.22, 0.1667, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type_name is None:\n type_name = ''.join([word.capitalize()\n for word in node.tagName.split('_')])\n top_node_name = node.tagName\n logging.warn('Found Top Node Name: ' + top_node_name)\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L94_C8", "label": "type_name = join()", "type": "assigned_variable", "loc": [94, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "vector": [14, 4, 0.8289, 0.0175, 4, 0.65, 0.0, 81, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "type_name", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " type_name = ''.join([word.capitalize()\n for word in node.tagName.split('_')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L96_C8", "label": "top_node_name =", "type": "assigned_variable", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "vector": [14, 4, 0.8421, 0.0088, 4, 0.65, 0.5, 238, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "top_node_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " top_node_name = node.tagName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L97_C8", "label": "warn()", "type": "expression", "loc": [97, 97], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "vector": [8, 4, 0.8509, 0.0088, 4, 0.65, 1.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Found Top Node Name: ' + top_node_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L100_C6", "label": "typ = getAttribute()", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [14, 3, 0.8772, 0.0088, 3, 0.22, 0.3333, 722, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "typ", "arg_names": [], "import_names": [], "rhs_call_name": "getAttribute", "annotation": ""}, "snippet": " typ = node.getAttribute('type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L101_C6", "label": "child = getAttribute()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [14, 3, 0.886, 0.0088, 3, 0.22, 0.5, 967, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "getAttribute", "annotation": ""}, "snippet": " child = node.getAttribute('child')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "label": "if", "type": "if", "loc": [103, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [4, 3, 0.9342, 0.0702, 3, 0.22, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ in COMPLEX:\n logging.warn('Found Complex: ' + node.tagName)\n level = 1\n elif typ not in TYPES:\n logging.warn('Found String: ' + typ)\n typ = STRING\n else:\n logging.warn('Found Type: ' + typ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L104_C8", "label": "warn()", "type": "expression", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "vector": [8, 4, 0.9123, 0.0088, 4, 0.88, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Found Complex: ' + node.tagName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L105_C8", "label": "level =", "type": "assigned_variable", "loc": [105, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "vector": [14, 4, 0.9211, 0.0088, 4, 0.88, 0.5, 479, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " level = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "label": "if", "type": "if", "loc": [106, 110], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "vector": [4, 4, 0.9474, 0.0439, 4, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif typ not in TYPES:\n logging.warn('Found String: ' + typ)\n typ = STRING\n else:\n logging.warn('Found Type: ' + typ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L107_C8", "label": "warn()", "type": "expression", "loc": [107, 107], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "vector": [8, 5, 0.9386, 0.0088, 5, 0.25, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Found String: ' + typ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L108_C8", "label": "typ =", "type": "assigned_variable", "loc": [108, 108], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "vector": [14, 5, 0.9474, 0.0088, 5, 0.25, 0.5, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "typ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " typ = STRING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L110_C8", "label": "warn()", "type": "expression", "loc": [110, 110], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "vector": [8, 5, 0.9649, 0.0088, 5, 0.25, 1.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Found Type: ' + typ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L111_C6", "label": "warn()", "type": "expression", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [8, 3, 0.9737, 0.0088, 3, 0.22, 0.8333, 960, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Adding: ' + str((node, typ)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L112_C6", "label": "setdefault()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "vector": [8, 3, 0.9825, 0.0088, 3, 0.22, 1.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " attributes.setdefault(node.tagName, (typ, [child]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L113_C2", "label": "warn()", "type": "expression", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [8, 1, 0.9912, 0.0088, 1, 0.62, 0.875, 960, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Attr: ' + str((type_name, top_node_name, attributes)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_830:Return_L114_C2", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "vector": [13, 1, 1.0, 0.0088, 1, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type_name, top_node_name, attributes"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L81_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L85_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:For_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L91_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L93_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L101_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L103_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L106_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L111_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:If_L90_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L112_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Expr_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_830:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_830:Return_L114_C2"}] |
# Run from the commandline:
#
# python server.py
# POST audio to http://localhost:9000
# GET audio from http://localhost:9000
#
# A simple server to collect audio using python. To be more secure,
# you might want to check the file names and place size restrictions
# on the incoming data.
import cgi
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class WamiHandler(BaseHTTPRequestHandler):
dirname = "/tmp/"
def do_GET(self):
f = open(self.get_name())
self.send_response(200)
self.send_header('content-type','audio/x-wav')
self.end_headers()
self.wfile.write(f.read())
f.close()
def do_POST(self):
f = open(self.get_name(), "wb")
# Note that python's HTTPServer doesn't support chunked transfer.
# Thus, it requires a content-length.
length = int(self.headers.getheader('content-length'))
print "POST of length " + str(length)
f.write(self.rfile.read(length))
f.close();
def get_name(self):
filename = 'output.wav';
qs = self.path.split('?',1);
if len(qs) == 2:
params = cgi.parse_qs(qs[1])
if params['name']:
filename = params['name'][0];
return WamiHandler.dirname + filename
def main():
try:
server = HTTPServer(('', 9000), WamiHandler)
print 'Started server...'
server.serve_forever()
except KeyboardInterrupt:
print 'Stopping server'
server.socket.close()
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_831 | 34 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_831:Import_L11_C0", "label": "cgi import cgi", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2075, 0.0189, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:ImportFrom_L12_C0", "label": "from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2264, 0.0189, 0, 0.66, 0.25, 801, 0, 2, 0, 0, 801, 0, 0], "semantic": {"name": "BaseHTTPServer", "arg_names": [], "import_names": ["BaseHTTPRequestHandler", "HTTPServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "label": "WamiHandler", "type": "class", "loc": [14, 41], "level": 0, "parent": null, "vector": [3, 0, 0.5189, 0.5283, 0, 0.66, 0.5, 732, 0, 3, 0, 0, 152, 0, 20], "semantic": {"name": "WamiHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WamiHandler(BaseHTTPRequestHandler):\n dirname = \"/tmp/\"\n \n def do_GET(self):\n f = open(self.get_name())\n self.send_response(200)\n self.send_header('content-type','audio/x-wav')\n self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L15_C4", "label": "dirname =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "vector": [14, 1, 0.283, 0.0189, 1, 0.69, 0.0, 959, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dirname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dirname = \"/tmp/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "label": "do_GET", "type": "function", "loc": [17, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "vector": [2, 1, 0.3774, 0.1321, 1, 0.69, 0.3333, 269, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "do_GET", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_GET(self):\n f = open(self.get_name())\n self.send_response(200)\n self.send_header('content-type','audio/x-wav')\n self.end_headers()\n self.wfile.write(f.read())\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L18_C8", "label": "f = open()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [14, 2, 0.3396, 0.0189, 2, 0.36, 0.0, 899, 3, 1, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(self.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L19_C8", "label": "send_response()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [8, 2, 0.3585, 0.0189, 2, 0.36, 0.2, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response(200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L20_C8", "label": "send_header()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [8, 2, 0.3774, 0.0189, 2, 0.36, 0.4, 81, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send_header", "arg_names": [], "import_names": [], "rhs_call_name": "send_header", "annotation": ""}, "snippet": " self.send_header('content-type','audio/x-wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L21_C8", "label": "end_headers()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [8, 2, 0.3962, 0.0189, 2, 0.36, 0.6, 683, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_headers", "arg_names": [], "import_names": [], "rhs_call_name": "end_headers", "annotation": ""}, "snippet": " self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L22_C8", "label": "write()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [8, 2, 0.4151, 0.0189, 2, 0.36, 0.8, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.wfile.write(f.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L23_C8", "label": "close()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "vector": [8, 2, 0.434, 0.0189, 2, 0.36, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "label": "do_POST", "type": "function", "loc": [25, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "vector": [2, 1, 0.5377, 0.1509, 1, 0.69, 0.6667, 67, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "do_POST", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_POST(self):\n f = open(self.get_name(), \"wb\")\n # Note that python's HTTPServer doesn't support chunked transfer.\n # Thus, it requires a content-length.\n length = int(self.headers.getheader('content-length'))\n print(\"POST of length \" + str(length))\n f.write(self.rfile.read(length))\n f.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L26_C8", "label": "f = open()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "vector": [14, 2, 0.4906, 0.0189, 2, 0.67, 0.0, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(self.get_name(), \"wb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L29_C8", "label": "length = int()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "vector": [14, 2, 0.5472, 0.0189, 2, 0.67, 0.25, 221, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " length = int(self.headers.getheader('content-length'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L30_C8", "label": "print()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "vector": [8, 2, 0.566, 0.0189, 2, 0.67, 0.5, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"POST of length \" + str(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L31_C8", "label": "write()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "vector": [8, 2, 0.5849, 0.0189, 2, 0.67, 0.75, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(self.rfile.read(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L32_C8", "label": "close()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "vector": [8, 2, 0.6038, 0.0189, 2, 0.67, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "label": "get_name", "type": "function", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "vector": [2, 1, 0.7075, 0.1509, 1, 0.69, 1.0, 770, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n filename = 'output.wav';\n qs = self.path.split('?',1);\n if len(qs) == 2:\n params = cgi.parse_qs(qs[1])\n if params['name']:\n filename = params['name'][0];\n return WamiHandler.dirname + filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L35_C8", "label": "filename =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "vector": [14, 2, 0.6604, 0.0189, 2, 0.8, 0.0, 275, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = 'output.wav';"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L36_C8", "label": "qs = split()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "vector": [14, 2, 0.6792, 0.0189, 2, 0.8, 0.3333, 251, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " qs = self.path.split('?',1);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "vector": [4, 2, 0.7264, 0.0755, 2, 0.8, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(qs) == 2:\n params = cgi.parse_qs(qs[1])\n if params['name']:\n filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L38_C12", "label": "params = parse_qs()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8", "vector": [14, 3, 0.717, 0.0189, 3, 0.52, 0.0, 206, 3, 1, 0, 0, 709, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " params = cgi.parse_qs(qs[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:If_L39_C12", "label": "if", "type": "if", "loc": [39, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8", "vector": [4, 3, 0.7453, 0.0377, 3, 0.52, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if params['name']:\n filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L40_C16", "label": "filename =", "type": "assigned_variable", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:If_L39_C12", "vector": [14, 4, 0.7547, 0.0189, 4, 0.74, 0.0, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "vector": [13, 2, 0.7736, 0.0189, 2, 0.8, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return WamiHandler.dirname + filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L43_C0", "label": "main", "type": "function", "loc": [43, 50], "level": 0, "parent": null, "vector": [2, 0, 0.8774, 0.1509, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n try:\n server = HTTPServer(('', 9000), WamiHandler)\n print('Started server...')\n server.serve_forever()\n except KeyboardInterrupt:\n print('Stopping server')\n server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "label": "try", "type": "try", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L43_C0", "vector": [7, 1, 0.8868, 0.1321, 1, 0.32, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n server = HTTPServer(('', 9000), WamiHandler)\n print('Started server...')\n server.serve_forever()\n except KeyboardInterrupt:\n print('Stopping server')\n server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L45_C8", "label": "server = HTTPServer()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "vector": [14, 2, 0.8491, 0.0189, 2, 0.15, 0.0, 268, 3, 2, 0, 0, 258, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " server = HTTPServer(('', 9000), WamiHandler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "vector": [8, 2, 0.8679, 0.0189, 2, 0.15, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Started server...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L47_C8", "label": "serve_forever()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "vector": [8, 2, 0.8868, 0.0189, 2, 0.15, 1.0, 993, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "serve_forever", "arg_names": [], "import_names": [], "rhs_call_name": "serve_forever", "annotation": ""}, "snippet": " server.serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L49_C8", "label": "print()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "vector": [8, 2, 0.9245, 0.0189, 2, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Stopping server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L50_C8", "label": "close()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "vector": [8, 2, 0.9434, 0.0189, 2, 0.15, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:If_L52_C0", "label": "if", "type": "if", "loc": [52, 53], "level": 0, "parent": null, "vector": [4, 0, 0.9906, 0.0377, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L53_C4", "label": "main()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_831:If_L52_C0", "vector": [8, 1, 1.0, 0.0189, 1, 0.3, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_831:If_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:If_L39_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_831:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_831:Expr_L53_C4"}] |
'''
Created on 21-03-2011
@author: maciek
'''
def formatString(format, **kwargs):
'''
'''
if not format: return ''
for arg in kwargs.keys():
format = format.replace("{" + arg + "}", "##" + arg + "##")
format = format.replace ("{", "{{")
format = format.replace("}", "}}")
for arg in kwargs.keys():
format = format.replace("##" + arg + "##", "{" + arg + "}")
res = format.format(**kwargs)
res = res.replace("{{", "{")
res = res.replace("}}", "}")
return res | ajibawa-2023/Python-Code-Large/train/row_832 | 15 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_832:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1304, 0.2174, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 21-03-2011\n\n@author: maciek\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "label": "formatString", "type": "function", "loc": [8, 23], "level": 0, "parent": null, "vector": [2, 0, 0.6739, 0.6957, 0, 0.66, 1.0, 798, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "formatString", "arg_names": ["format", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def formatString(format, **kwargs):\n '''\n '''\n if not format: return ''\n \n for arg in kwargs.keys():\n format = format.replace(\"{\" + arg + \"}\", \"##\" + arg + \"##\")\n format = format.replace (\"{\", \"{{\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Expr_L9_C4", "label": "expression", "type": "expression", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [8, 1, 0.413, 0.087, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:If_L11_C4", "label": "if", "type": "if", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [4, 1, 0.4783, 0.0435, 1, 0.05, 0.1111, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not format: return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Return_L11_C20", "label": "return", "type": "return", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:If_L11_C4", "vector": [13, 2, 0.4783, 0.0435, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not format: return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:For_L13_C4", "label": "for arg", "type": "for", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [6, 1, 0.587, 0.087, 1, 0.05, 0.2222, 447, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "arg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for arg in kwargs.keys():\n format = format.replace(\"{\" + arg + \"}\", \"##\" + arg + \"##\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L14_C8", "label": "format = replace()", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:For_L13_C4", "vector": [14, 2, 0.6087, 0.0435, 2, 0.31, 0.0, 293, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " format = format.replace(\"{\" + arg + \"}\", \"##\" + arg + \"##\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L15_C4", "label": "format = replace()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [14, 1, 0.6522, 0.0435, 1, 0.05, 0.3333, 293, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " format = format.replace (\"{\", \"{{\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L16_C4", "label": "format = replace()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [14, 1, 0.6957, 0.0435, 1, 0.05, 0.4444, 293, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " format = format.replace(\"}\", \"}}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:For_L17_C4", "label": "for arg", "type": "for", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [6, 1, 0.7609, 0.087, 1, 0.05, 0.5556, 447, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "arg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for arg in kwargs.keys():\n format = format.replace(\"##\" + arg + \"##\", \"{\" + arg + \"}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L18_C8", "label": "format = replace()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:For_L17_C4", "vector": [14, 2, 0.7826, 0.0435, 2, 0.93, 0.0, 293, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " format = format.replace(\"##\" + arg + \"##\", \"{\" + arg + \"}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L20_C4", "label": "res = format()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [14, 1, 0.8696, 0.0435, 1, 0.05, 0.6667, 413, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " res = format.format(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L21_C4", "label": "res = replace()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [14, 1, 0.913, 0.0435, 1, 0.05, 0.7778, 413, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " res = res.replace(\"{{\", \"{\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L22_C4", "label": "res = replace()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [14, 1, 0.9565, 0.0435, 1, 0.05, 0.8889, 413, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " res = res.replace(\"}}\", \"}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_832:Return_L23_C4", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "vector": [13, 1, 1.0, 0.0435, 1, 0.05, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:If_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Return_L11_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:For_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_832:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_832:Return_L23_C4"}] |
'''
Created on 21-03-2011
@author: maciek
'''
from IndexGenerator import IndexGenerator
from optparse import OptionParser
import os
import tempfile
import shutil
import logging
logging.basicConfig(level = logging.DEBUG)
parser = OptionParser()
parser.add_option('-n', '--app-name', action='store', dest='appName', help='aplication name')
parser.add_option('-u', '--release-urls', action='store', dest='releaseUrls', help='URLs of download files - as coma separated list of entrires')
parser.add_option('-d', '--destination-directory', action='store', dest='otaAppDir', help='Directory where OTA files are created')
parser.add_option('-v', '--version', action='store', dest='version', help='Version of the application')
parser.add_option('-r', '--releases', action='store', dest='releases', help='Release names of the application')
parser.add_option('-R', '--release-notes', action='store', dest='releaseNotes', help='Release notes of the application (in txt2tags format)')
parser.add_option('-D', '--description', action='store', dest='description', help='Description of the application (in txt2tags format)')
(options, args) = parser.parse_args()
if options.appName == None:
parser.error("Please specify the appName.")
elif options.releaseUrls == None:
parser.error("Please specify releaseUrls")
elif options.otaAppDir == None:
parser.error("Please specify destination directory")
elif options.version == None:
parser.error("Please specify version")
elif options.releases == None:
parser.error("Please specify releases")
elif options.releaseNotes == None:
parser.error("Please specify releaseNotes")
elif options.description == None:
parser.error("Please specify description")
appName = options.appName
releaseUrls = options.releaseUrls
otaAppDir = options.otaAppDir
version = options.version
releases = options.releases
releaseNotes = options.releaseNotes
description = options.description
def findIconFilename():
iconPath = "res/drawable-hdpi/icon.png"
if not os.path.exists(iconPath):
iconPath = "res/drawable-mdpi/icon.png"
if not os.path.exists(iconPath):
iconPath = "res/drawable-ldpi/icon.png"
if not os.path.exists(iconPath):
iconPath = "res/drawable/icon.png"
logging.debug("IconPath: "+iconPath)
return iconPath
def createOTApackage():
'''
crates all needed files in tmp dir
'''
releaseNotesContent = open(releaseNotes).read()
descriptionContent = open(description).read()
indexGenerator = IndexGenerator(appName, releaseUrls, releaseNotesContent, descriptionContent, version, releases)
index = indexGenerator.get();
tempIndexFile = tempfile.TemporaryFile()
tempIndexFile.write(index)
tempIndexFile.flush()
tempIndexFile.seek(0)
return tempIndexFile
tempIndexFile = createOTApackage()
if not os.path.isdir(otaAppDir):
logging.debug("creating dir: "+otaAppDir)
os.mkdir(otaAppDir)
else:
logging.warning("dir: "+otaAppDir+" exists")
indexFile = open(os.path.join(otaAppDir,"index.html"),'w')
shutil.copyfileobj(tempIndexFile, indexFile)
srcIconFileName = findIconFilename()
disIconFileName = os.path.join(otaAppDir,"Icon.png")
shutil.copy(srcIconFileName,disIconFileName)
| ajibawa-2023/Python-Code-Large/train/row_833 | 69 | 88 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0341, 0.0568, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 21-03-2011\n\n@author: maciek\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:ImportFrom_L6_C0", "label": "from IndexGenerator import IndexGenerator", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0682, 0.0114, 0, 0.66, 0.0303, 933, 0, 1, 0, 0, 933, 0, 0], "semantic": {"name": "IndexGenerator", "arg_names": [], "import_names": ["IndexGenerator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from IndexGenerator import IndexGenerator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:ImportFrom_L7_C0", "label": "from optparse import OptionParser", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0795, 0.0114, 0, 0.66, 0.0606, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0114, 0, 0.66, 0.0909, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Import_L9_C0", "label": "tempfile import tempfile", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1023, 0.0114, 0, 0.66, 0.1212, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "tempfile", "arg_names": [], "import_names": ["tempfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tempfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Import_L10_C0", "label": "shutil import shutil", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1136, 0.0114, 0, 0.66, 0.1515, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["shutil"], "rhs_call_name": "", "annotation": ""}, "snippet": "import shutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Import_L11_C0", "label": "logging import logging", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0114, 0, 0.66, 0.1818, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L13_C0", "label": "basicConfig()", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1477, 0.0114, 0, 0.66, 0.2121, 256, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "basicConfig", "arg_names": [], "import_names": [], "rhs_call_name": "basicConfig", "annotation": ""}, "snippet": "logging.basicConfig(level = logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L15_C0", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1705, 0.0114, 0, 0.66, 0.2424, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": "parser = OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L16_C0", "label": "add_option()", "type": "expression", "loc": [16, 16], "level": 0, "parent": null, "vector": [8, 0, 0.1818, 0.0114, 0, 0.66, 0.2727, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-n', '--app-name', action='store', dest='appName', help='aplication name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L17_C0", "label": "add_option()", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1932, 0.0114, 0, 0.66, 0.303, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-u', '--release-urls', action='store', dest='releaseUrls', help='URLs of download files - as coma separated list of entrires')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L18_C0", "label": "add_option()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.2045, 0.0114, 0, 0.66, 0.3333, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-d', '--destination-directory', action='store', dest='otaAppDir', help='Directory where OTA files are created')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L19_C0", "label": "add_option()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2159, 0.0114, 0, 0.66, 0.3636, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-v', '--version', action='store', dest='version', help='Version of the application')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L20_C0", "label": "add_option()", "type": "expression", "loc": [20, 20], "level": 0, "parent": null, "vector": [8, 0, 0.2273, 0.0114, 0, 0.66, 0.3939, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-r', '--releases', action='store', dest='releases', help='Release names of the application')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L21_C0", "label": "add_option()", "type": "expression", "loc": [21, 21], "level": 0, "parent": null, "vector": [8, 0, 0.2386, 0.0114, 0, 0.66, 0.4242, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-R', '--release-notes', action='store', dest='releaseNotes', help='Release notes of the application (in txt2tags format)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L22_C0", "label": "add_option()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.0114, 0, 0.66, 0.4545, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": "parser.add_option('-D', '--description', action='store', dest='description', help='Description of the application (in txt2tags format)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L24_C0", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.2727, 0.0114, 0, 0.66, 0.4848, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": "(options, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "label": "if", "type": "if", "loc": [26, 39], "level": 0, "parent": null, "vector": [4, 0, 0.3693, 0.1591, 0, 0.66, 0.5152, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if options.appName == None:\n parser.error(\"Please specify the appName.\")\nelif options.releaseUrls == None:\n parser.error(\"Please specify releaseUrls\")\nelif options.otaAppDir == None:\n parser.error(\"Please specify destination directory\")\nelif options.version == None:\n parser.error(\"Please specify version\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L27_C4", "label": "error()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "vector": [8, 1, 0.3068, 0.0114, 1, 0.87, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify the appName.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0", "label": "if", "type": "if", "loc": [28, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "vector": [4, 1, 0.3807, 0.1364, 1, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.releaseUrls == None:\n parser.error(\"Please specify releaseUrls\")\nelif options.otaAppDir == None:\n parser.error(\"Please specify destination directory\")\nelif options.version == None:\n parser.error(\"Please specify version\")\nelif options.releases == None:\n parser.error(\"Please specify releases\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L29_C4", "label": "error()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0", "vector": [8, 2, 0.3295, 0.0114, 2, 0.98, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify releaseUrls\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0", "label": "if", "type": "if", "loc": [30, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0", "vector": [4, 2, 0.392, 0.1136, 2, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.otaAppDir == None:\n parser.error(\"Please specify destination directory\")\nelif options.version == None:\n parser.error(\"Please specify version\")\nelif options.releases == None:\n parser.error(\"Please specify releases\")\nelif options.releaseNotes == None:\n parser.error(\"Please specify releaseNotes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L31_C4", "label": "error()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0", "vector": [8, 3, 0.3523, 0.0114, 3, 0.77, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify destination directory\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0", "label": "if", "type": "if", "loc": [32, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0", "vector": [4, 3, 0.4034, 0.0909, 3, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.version == None:\n parser.error(\"Please specify version\")\nelif options.releases == None:\n parser.error(\"Please specify releases\")\nelif options.releaseNotes == None:\n parser.error(\"Please specify releaseNotes\")\nelif options.description == None:\n parser.error(\"Please specify description\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L33_C4", "label": "error()", "type": "expression", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0", "vector": [8, 4, 0.375, 0.0114, 4, 0.54, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify version\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0", "label": "if", "type": "if", "loc": [34, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0", "vector": [4, 4, 0.4148, 0.0682, 4, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.releases == None:\n parser.error(\"Please specify releases\")\nelif options.releaseNotes == None:\n parser.error(\"Please specify releaseNotes\")\nelif options.description == None:\n parser.error(\"Please specify description\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L35_C4", "label": "error()", "type": "expression", "loc": [35, 35], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0", "vector": [8, 5, 0.3977, 0.0114, 5, 0.75, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify releases\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0", "label": "if", "type": "if", "loc": [36, 39], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0", "vector": [4, 5, 0.4261, 0.0455, 5, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.releaseNotes == None:\n parser.error(\"Please specify releaseNotes\")\nelif options.description == None:\n parser.error(\"Please specify description\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L37_C4", "label": "error()", "type": "expression", "loc": [37, 37], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0", "vector": [8, 6, 0.4205, 0.0114, 6, 0.79, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify releaseNotes\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L38_C0", "label": "if", "type": "if", "loc": [38, 39], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0", "vector": [4, 6, 0.4375, 0.0227, 6, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif options.description == None:\n parser.error(\"Please specify description\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L39_C4", "label": "error()", "type": "expression", "loc": [39, 39], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L38_C0", "vector": [8, 7, 0.4432, 0.0114, 7, 0.81, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " parser.error(\"Please specify description\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L41_C0", "label": "appName =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.4659, 0.0114, 0, 0.66, 0.5455, 650, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "appName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "appName = options.appName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L42_C0", "label": "releaseUrls =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.4773, 0.0114, 0, 0.66, 0.5758, 680, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "releaseUrls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "releaseUrls = options.releaseUrls"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L43_C0", "label": "otaAppDir =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.4886, 0.0114, 0, 0.66, 0.6061, 24, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "otaAppDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "otaAppDir = options.otaAppDir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L44_C0", "label": "version =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0114, 0, 0.66, 0.6364, 623, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = options.version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L45_C0", "label": "releases =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.5114, 0.0114, 0, 0.66, 0.6667, 724, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "releases", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "releases = options.releases"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L46_C0", "label": "releaseNotes =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.5227, 0.0114, 0, 0.66, 0.697, 710, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "releaseNotes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "releaseNotes = options.releaseNotes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L47_C0", "label": "description =", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.5341, 0.0114, 0, 0.66, 0.7273, 306, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "description = options.description"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "label": "findIconFilename", "type": "function", "loc": [49, 59], "level": 0, "parent": null, "vector": [2, 0, 0.6136, 0.125, 0, 0.66, 0.7576, 233, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "findIconFilename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def findIconFilename():\n iconPath = \"res/drawable-hdpi/icon.png\"\n if not os.path.exists(iconPath):\n iconPath = \"res/drawable-mdpi/icon.png\"\n if not os.path.exists(iconPath):\n iconPath = \"res/drawable-ldpi/icon.png\"\n if not os.path.exists(iconPath):\n iconPath = \"res/drawable/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L50_C4", "label": "iconPath =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [14, 1, 0.5682, 0.0114, 1, 0.71, 0.0, 122, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "iconPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iconPath = \"res/drawable-hdpi/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L51_C4", "label": "if", "type": "if", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [4, 1, 0.5852, 0.0227, 1, 0.71, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(iconPath):\n iconPath = \"res/drawable-mdpi/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L52_C8", "label": "iconPath =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L51_C4", "vector": [14, 2, 0.5909, 0.0114, 2, 0.02, 0.0, 122, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "iconPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iconPath = \"res/drawable-mdpi/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L53_C4", "label": "if", "type": "if", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [4, 1, 0.608, 0.0227, 1, 0.71, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(iconPath):\n iconPath = \"res/drawable-ldpi/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L54_C8", "label": "iconPath =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L53_C4", "vector": [14, 2, 0.6136, 0.0114, 2, 0.99, 0.0, 122, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "iconPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iconPath = \"res/drawable-ldpi/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L55_C4", "label": "if", "type": "if", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [4, 1, 0.6307, 0.0227, 1, 0.71, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.exists(iconPath):\n iconPath = \"res/drawable/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L56_C8", "label": "iconPath =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L55_C4", "vector": [14, 2, 0.6364, 0.0114, 2, 0.09, 0.0, 122, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "iconPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iconPath = \"res/drawable/icon.png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L58_C4", "label": "debug()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [8, 1, 0.6591, 0.0114, 1, 0.71, 0.8, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug(\"IconPath: \"+iconPath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Return_L59_C4", "label": "return", "type": "return", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "vector": [13, 1, 0.6705, 0.0114, 1, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return iconPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "label": "createOTApackage", "type": "function", "loc": [61, 75], "level": 0, "parent": null, "vector": [2, 0, 0.7727, 0.1705, 0, 0.66, 0.7879, 417, 0, 0, 1, 0, 0, 0, 10], "semantic": {"name": "createOTApackage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createOTApackage():\n '''\n crates all needed files in tmp dir\n '''\n\n releaseNotesContent = open(releaseNotes).read()\n descriptionContent = open(description).read()\n indexGenerator = IndexGenerator(appName, releaseUrls, releaseNotesContent, descriptionContent, version, releases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [8, 1, 0.7159, 0.0341, 1, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n crates all needed files in tmp dir\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L66_C4", "label": "releaseNotesContent = read()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [14, 1, 0.75, 0.0114, 1, 0.29, 0.1111, 620, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "releaseNotesContent", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " releaseNotesContent = open(releaseNotes).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L67_C4", "label": "descriptionContent = read()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [14, 1, 0.7614, 0.0114, 1, 0.29, 0.2222, 905, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "descriptionContent", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " descriptionContent = open(description).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L68_C4", "label": "indexGenerator = IndexGenerator()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [14, 1, 0.7727, 0.0114, 1, 0.29, 0.3333, 859, 3, 6, 0, 0, 933, 10, 1], "semantic": {"name": "indexGenerator", "arg_names": [], "import_names": [], "rhs_call_name": "IndexGenerator", "annotation": ""}, "snippet": " indexGenerator = IndexGenerator(appName, releaseUrls, releaseNotesContent, descriptionContent, version, releases)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L69_C4", "label": "index = get()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [14, 1, 0.7841, 0.0114, 1, 0.29, 0.4444, 780, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " index = indexGenerator.get();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L70_C4", "label": "tempIndexFile = TemporaryFile()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [14, 1, 0.7955, 0.0114, 1, 0.29, 0.5556, 16, 3, 0, 0, 0, 549, 10, 1], "semantic": {"name": "tempIndexFile", "arg_names": [], "import_names": [], "rhs_call_name": "TemporaryFile", "annotation": ""}, "snippet": " tempIndexFile = tempfile.TemporaryFile()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L71_C4", "label": "write()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [8, 1, 0.8068, 0.0114, 1, 0.29, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " tempIndexFile.write(index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L72_C4", "label": "flush()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [8, 1, 0.8182, 0.0114, 1, 0.29, 0.7778, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " tempIndexFile.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L73_C4", "label": "seek()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [8, 1, 0.8295, 0.0114, 1, 0.29, 0.8889, 66, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " tempIndexFile.seek(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "vector": [13, 1, 0.8523, 0.0114, 1, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return tempIndexFile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L78_C0", "label": "tempIndexFile = createOTApackage()", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.8864, 0.0114, 0, 0.66, 0.8182, 16, 3, 0, 0, 0, 417, 10, 1], "semantic": {"name": "tempIndexFile", "arg_names": [], "import_names": [], "rhs_call_name": "createOTApackage", "annotation": ""}, "snippet": "tempIndexFile = createOTApackage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "label": "if", "type": "if", "loc": [79, 83], "level": 0, "parent": null, "vector": [4, 0, 0.9205, 0.0568, 0, 0.66, 0.8485, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not os.path.isdir(otaAppDir):\n logging.debug(\"creating dir: \"+otaAppDir)\n os.mkdir(otaAppDir)\nelse:\n logging.warning(\"dir: \"+otaAppDir+\" exists\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L80_C4", "label": "debug()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "vector": [8, 1, 0.9091, 0.0114, 1, 0.12, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug(\"creating dir: \"+otaAppDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L81_C4", "label": "mkdir()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "vector": [8, 1, 0.9205, 0.0114, 1, 0.12, 0.5, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(otaAppDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L83_C4", "label": "warning()", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "vector": [8, 1, 0.9432, 0.0114, 1, 0.12, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " logging.warning(\"dir: \"+otaAppDir+\" exists\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L84_C0", "label": "indexFile = open()", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.9545, 0.0114, 0, 0.66, 0.8788, 532, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "indexFile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": "indexFile = open(os.path.join(otaAppDir,\"index.html\"),'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L85_C0", "label": "copyfileobj()", "type": "expression", "loc": [85, 85], "level": 0, "parent": null, "vector": [8, 0, 0.9659, 0.0114, 0, 0.66, 0.9091, 462, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copyfileobj", "arg_names": [], "import_names": [], "rhs_call_name": "copyfileobj", "annotation": ""}, "snippet": "shutil.copyfileobj(tempIndexFile, indexFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L86_C0", "label": "srcIconFileName = findIconFilename()", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.9773, 0.0114, 0, 0.66, 0.9394, 12, 3, 0, 0, 0, 233, 10, 1], "semantic": {"name": "srcIconFileName", "arg_names": [], "import_names": [], "rhs_call_name": "findIconFilename", "annotation": ""}, "snippet": "srcIconFileName = findIconFilename()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L87_C0", "label": "disIconFileName = join()", "type": "assigned_variable", "loc": [87, 87], "level": 0, "parent": null, "vector": [14, 0, 0.9886, 0.0114, 0, 0.66, 0.9697, 284, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "disIconFileName", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "disIconFileName = os.path.join(otaAppDir,\"Icon.png\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L88_C0", "label": "copy()", "type": "expression", "loc": [88, 88], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0114, 0, 0.66, 1.0, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "shutil.copy(srcIconFileName,disIconFileName)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L38_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Return_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_833:If_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_833:Expr_L83_C4"}] |
'''
Created on 21-03-2011
@author: maciek
'''
from formater import formatString
import os
class IndexGenerator(object):
'''
Generates Index.html for iOS app OTA distribution
'''
basePath = os.path.dirname(__file__)
templateFile = os.path.join(basePath,"templates/index.tmpl")
releaseUrls = ""
appName = ""
changeLog = ""
description = ""
version = ""
release = ""
def __init__(self,appName, releaseUrls, changeLog, description, version, releases):
'''
Constructor
'''
self.appName = appName
self.releaseUrls = releaseUrls
self.changeLog = changeLog
self.description = description
self.version = version
self.releases = releases
def get(self):
'''
returns index.html source code from template file
'''
urlList = self.releaseUrls.split(",")
releaseList = self.releases.split(",")
generatedHtml=""
count=0;
for release in releaseList:
generatedHtml += " <li>\n"
generatedHtml += " <h3><a href=\"javascript:load('" + urlList[count] + "')\">" + release + "</a></h3>\n"
generatedHtml += " </li>\n"
count += 1
template = open(self.templateFile).read()
index = formatString(template, downloads=generatedHtml,
changeLog=self.changeLog,
appName=self.appName,
description=self.description,
version = self.version);
return index | ajibawa-2023/Python-Code-Large/train/row_834 | 31 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0526, 0.0877, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 21-03-2011\n\n@author: maciek\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:ImportFrom_L6_C0", "label": "from formater import formatString", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0175, 0, 0.66, 0.3333, 11, 0, 1, 0, 0, 11, 0, 0], "semantic": {"name": "formater", "arg_names": [], "import_names": ["formatString"], "rhs_call_name": "", "annotation": ""}, "snippet": "from formater import formatString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Import_L7_C0", "label": "os import os", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1228, 0.0175, 0, 0.66, 0.6667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "label": "IndexGenerator", "type": "class", "loc": [10, 57], "level": 0, "parent": null, "vector": [3, 0, 0.5877, 0.8421, 0, 0.66, 1.0, 933, 0, 2, 0, 0, 186, 0, 7], "semantic": {"name": "IndexGenerator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IndexGenerator(object):\n '''\n Generates Index.html for iOS app OTA distribution\n '''\n basePath = os.path.dirname(__file__)\n templateFile = os.path.join(basePath,\"templates/index.tmpl\")\n releaseUrls = \"\"\n appName = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [8, 1, 0.2105, 0.0526, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Generates Index.html for iOS app OTA distribution\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L14_C4", "label": "basePath = dirname()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.2456, 0.0175, 1, 0.45, 0.1, 45, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "basePath", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " basePath = os.path.dirname(__file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L15_C4", "label": "templateFile = join()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.2632, 0.0175, 1, 0.45, 0.2, 88, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "templateFile", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " templateFile = os.path.join(basePath,\"templates/index.tmpl\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L16_C4", "label": "releaseUrls =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.2807, 0.0175, 1, 0.45, 0.3, 680, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "releaseUrls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " releaseUrls = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L17_C4", "label": "appName =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.2982, 0.0175, 1, 0.45, 0.4, 650, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "appName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " appName = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L18_C4", "label": "changeLog =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.3158, 0.0175, 1, 0.45, 0.5, 132, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "changeLog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changeLog = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L19_C4", "label": "description =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.3333, 0.0175, 1, 0.45, 0.6, 306, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " description = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L20_C4", "label": "version =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.3509, 0.0175, 1, 0.45, 0.7, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L21_C4", "label": "release =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [14, 1, 0.3684, 0.0175, 1, 0.45, 0.8, 784, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " release = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "label": "__init__", "type": "function", "loc": [23, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [2, 1, 0.4825, 0.1754, 1, 0.45, 0.9, 555, 0, 7, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "appName", "releaseUrls", "changeLog", "description", "version", "releases"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,appName, releaseUrls, changeLog, description, version, releases):\n '''\n Constructor\n '''\n self.appName = appName\n self.releaseUrls = releaseUrls\n self.changeLog = changeLog\n self.description = description"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L24_C8", "label": "expression", "type": "expression", "loc": [24, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [8, 2, 0.4386, 0.0526, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L27_C8", "label": "self.appName =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.4737, 0.0175, 2, 0.91, 0.1667, 581, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.appName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.appName = appName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L28_C8", "label": "self.releaseUrls =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.4912, 0.0175, 2, 0.91, 0.3333, 868, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.releaseUrls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.releaseUrls = releaseUrls"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L29_C8", "label": "self.changeLog =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.5088, 0.0175, 2, 0.91, 0.5, 634, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.changeLog", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.changeLog = changeLog"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L30_C8", "label": "self.description =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.5263, 0.0175, 2, 0.91, 0.6667, 171, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.description", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.description = description"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L31_C8", "label": "self.version =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.5439, 0.0175, 2, 0.91, 0.8333, 686, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.version = version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L32_C8", "label": "self.releases =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "vector": [14, 2, 0.5614, 0.0175, 2, 0.91, 1.0, 79, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.releases", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.releases = releases"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "label": "get", "type": "function", "loc": [34, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "vector": [2, 1, 0.7982, 0.4211, 1, 0.45, 1.0, 607, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n '''\n returns index.html source code from template file\n '''\n\n urlList = self.releaseUrls.split(\",\")\n releaseList = self.releases.split(\",\")\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L35_C8", "label": "expression", "type": "expression", "loc": [35, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [8, 2, 0.6316, 0.0526, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n returns index.html source code from template file\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L39_C8", "label": "urlList = split()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.6842, 0.0175, 2, 0.77, 0.125, 675, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "urlList", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " urlList = self.releaseUrls.split(\",\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L40_C8", "label": "releaseList = split()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.7018, 0.0175, 2, 0.77, 0.25, 221, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "releaseList", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " releaseList = self.releases.split(\",\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L42_C8", "label": "generatedHtml =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.7368, 0.0175, 2, 0.77, 0.375, 372, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "generatedHtml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " generatedHtml=\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L44_C8", "label": "count =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.7719, 0.0175, 2, 0.77, 0.5, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:For_L45_C8", "label": "for release", "type": "for", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [6, 2, 0.8246, 0.0877, 2, 0.77, 0.625, 784, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for release in releaseList:\n generatedHtml += \" <li>\\n\"\n generatedHtml += \" <h3><a href=\\\"javascript:load('\" + urlList[count] + \"')\\\">\" + release + \"</a></h3>\\n\"\n generatedHtml += \" </li>\\n\"\n count += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L51_C8", "label": "template = read()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.8947, 0.0175, 2, 0.77, 0.75, 549, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "template", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " template = open(self.templateFile).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L52_C8", "label": "index = formatString()", "type": "assigned_variable", "loc": [52, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [14, 2, 0.9474, 0.0877, 2, 0.77, 0.875, 780, 3, 6, 0, 0, 798, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "formatString", "annotation": ""}, "snippet": " index = formatString(template, downloads=generatedHtml,\n changeLog=self.changeLog,\n appName=self.appName,\n description=self.description,\n version = self.version);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_834:Return_L57_C8", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "vector": [13, 2, 1.0, 0.0175, 2, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return index"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:For_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_834:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_834:Return_L57_C8"}] |
# Django settings for iphone12580 project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'w%4yt1@#$mqd$*_ip%1xhl+(mbg$+4i5qa5t#kp@ac5eyvp40d'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'iphone12580.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/Users/uc0079/iphone12580/templates'
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
)
| ajibawa-2023/Python-Code-Large/train/row_835 | 23 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L3_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0375, 0.0125, 0, 0.66, 0.0, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEBUG = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L4_C0", "label": "TEMPLATE_DEBUG =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.05, 0.0125, 0, 0.66, 0.0455, 7, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEMPLATE_DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DEBUG = DEBUG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L6_C0", "label": "ADMINS =", "type": "assigned_variable", "loc": [6, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0875, 0.0375, 0, 0.66, 0.0909, 223, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "ADMINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ADMINS = (\n # ('Your Name', 'your_email@domain.com'),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L10_C0", "label": "MANAGERS =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.125, 0.0125, 0, 0.66, 0.1364, 275, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MANAGERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MANAGERS = ADMINS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L12_C0", "label": "DATABASE_ENGINE =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.15, 0.0125, 0, 0.66, 0.1818, 96, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_ENGINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L13_C0", "label": "DATABASE_NAME =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1625, 0.0125, 0, 0.66, 0.2273, 982, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_NAME = '' # Or path to database file if using sqlite3."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L14_C0", "label": "DATABASE_USER =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.175, 0.0125, 0, 0.66, 0.2727, 730, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_USER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_USER = '' # Not used with sqlite3."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L15_C0", "label": "DATABASE_PASSWORD =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1875, 0.0125, 0, 0.66, 0.3182, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_PASSWORD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_PASSWORD = '' # Not used with sqlite3."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L16_C0", "label": "DATABASE_HOST =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.2, 0.0125, 0, 0.66, 0.3636, 709, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_HOST", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L17_C0", "label": "DATABASE_PORT =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.2125, 0.0125, 0, 0.66, 0.4091, 53, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_PORT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L24_C0", "label": "TIME_ZONE =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.3, 0.0125, 0, 0.66, 0.4545, 774, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TIME_ZONE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TIME_ZONE = 'America/Chicago'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L28_C0", "label": "LANGUAGE_CODE =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.35, 0.0125, 0, 0.66, 0.5, 450, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LANGUAGE_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LANGUAGE_CODE = 'en-us'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L30_C0", "label": "SITE_ID =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.375, 0.0125, 0, 0.66, 0.5455, 122, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SITE_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SITE_ID = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L34_C0", "label": "USE_I18N =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.425, 0.0125, 0, 0.66, 0.5909, 547, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "USE_I18N", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USE_I18N = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L38_C0", "label": "MEDIA_ROOT =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.475, 0.0125, 0, 0.66, 0.6364, 764, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MEDIA_ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_ROOT = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L43_C0", "label": "MEDIA_URL =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.5375, 0.0125, 0, 0.66, 0.6818, 120, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MEDIA_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_URL = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L48_C0", "label": "ADMIN_MEDIA_PREFIX =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.0125, 0, 0.66, 0.7273, 396, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ADMIN_MEDIA_PREFIX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ADMIN_MEDIA_PREFIX = '/media/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L51_C0", "label": "SECRET_KEY =", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.6375, 0.0125, 0, 0.66, 0.7727, 112, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SECRET_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SECRET_KEY = 'w%4yt1@#$mqd$*_ip%1xhl+(mbg$+4i5qa5t#kp@ac5eyvp40d'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L54_C0", "label": "TEMPLATE_LOADERS =", "type": "assigned_variable", "loc": [54, 58], "level": 0, "parent": null, "vector": [14, 0, 0.7, 0.0625, 0, 0.66, 0.8182, 473, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "TEMPLATE_LOADERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.load_template_source',\n 'django.template.loaders.app_directories.load_template_source',\n# 'django.template.loaders.eggs.load_template_source',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L60_C0", "label": "MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [60, 64], "level": 0, "parent": null, "vector": [14, 0, 0.775, 0.0625, 0, 0.66, 0.8636, 641, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L66_C0", "label": "ROOT_URLCONF =", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.825, 0.0125, 0, 0.66, 0.9091, 281, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_URLCONF = 'iphone12580.urls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L68_C0", "label": "TEMPLATE_DIRS =", "type": "assigned_variable", "loc": [68, 73], "level": 0, "parent": null, "vector": [14, 0, 0.8812, 0.075, 0, 0.66, 0.9545, 910, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEMPLATE_DIRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DIRS = (\n # Put strings here, like \"/home/html/django_templates\" or \"C:/www/django/templates\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths. \n '/Users/uc0079/iphone12580/templates'\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_835:Assign_L75_C0", "label": "INSTALLED_APPS =", "type": "assigned_variable", "loc": [75, 80], "level": 0, "parent": null, "vector": [14, 0, 0.9688, 0.075, 0, 0.66, 1.0, 648, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INSTALLED_APPS = (\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n)"}] | [] |
from django.db import models
# Create your models here.
| ajibawa-2023/Python-Code-Large/train/row_836 | 1 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_836:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}] | [] |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}
| ajibawa-2023/Python-Code-Large/train/row_837 | 7 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.1522, 0.2609, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file demonstrates two different styles of tests (one doctest and one\nunittest). These will both pass when you run \"manage.py test\".\n\nReplace these with more appropriate tests for your application.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:ImportFrom_L8_C0", "label": "from django.test import TestCase", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.3478, 0.0435, 0, 0.66, 0.3333, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:ClassDef_L10_C0", "label": "SimpleTest", "type": "class", "loc": [10, 15], "level": 0, "parent": null, "vector": [3, 0, 0.5435, 0.2609, 0, 0.66, 0.6667, 47, 0, 1, 0, 0, 3, 0, 1], "semantic": {"name": "SimpleTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SimpleTest(TestCase):\n def test_basic_addition(self):\n \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\"\n self.failUnlessEqual(1 + 1, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "label": "test_basic_addition", "type": "function", "loc": [11, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_837:ClassDef_L10_C0", "vector": [2, 1, 0.5652, 0.2174, 1, 0.0, 0.0, 153, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_basic_addition", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_basic_addition(self):\n \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\"\n self.failUnlessEqual(1 + 1, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L12_C8", "label": "expression", "type": "expression", "loc": [12, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "vector": [8, 2, 0.5652, 0.1304, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L15_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "vector": [8, 2, 0.6522, 0.0435, 2, 0.18, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(1 + 1, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_837:Assign_L17_C0", "label": "__test__ =", "type": "assigned_variable", "loc": [17, 22], "level": 0, "parent": null, "vector": [14, 0, 0.8478, 0.2609, 0, 0.66, 1.0, 761, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "__test__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__test__ = {\"doctest\": \"\"\"\nAnother way to test that 1 + 1 is equal to 2.\n\n>>> 1 + 1 == 2\nTrue\n\"\"\"}"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_837:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_837:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_837:Expr_L15_C8"}] |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.core.paginator import Paginator,InvalidPage,EmptyPage
def test(request):
return HttpResponse("hello iphone")
def index(request):
return render_to_response("index.html",locals())
def dis_info(request):
return render_to_response("discount.html",locals())
def hotel_info(request):
return render_to_response("hotel_info.html",locals())
def flight_info(request):
return render_to_response("flight_info.html",locals()) | ajibawa-2023/Python-Code-Large/train/row_838 | 13 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_838:ImportFrom_L2_C0", "label": "from django.http import HttpResponseRedirect, HttpResponse, Http404", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1053, 0.0526, 0, 0.66, 0.0, 779, 0, 3, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect", "HttpResponse", "Http404"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect, HttpResponse, Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:ImportFrom_L3_C0", "label": "from django.shortcuts import render_to_response", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0526, 0, 0.66, 0.1429, 852, 0, 1, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.shortcuts import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:ImportFrom_L4_C0", "label": "from django.core.paginator import Paginator, InvalidPage, EmptyPage", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0526, 0, 0.66, 0.2857, 831, 0, 3, 0, 0, 831, 0, 0], "semantic": {"name": "django.core.paginator", "arg_names": [], "import_names": ["Paginator", "InvalidPage", "EmptyPage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.paginator import Paginator,InvalidPage,EmptyPage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L6_C0", "label": "test", "type": "function", "loc": [6, 7], "level": 0, "parent": null, "vector": [2, 0, 0.3421, 0.1053, 0, 0.66, 0.4286, 224, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(request):\n return HttpResponse(\"hello iphone\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L7_C4", "label": "return", "type": "return", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L6_C0", "vector": [13, 1, 0.3684, 0.0526, 1, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(\"hello iphone\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L9_C0", "label": "index", "type": "function", "loc": [9, 10], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.1053, 0, 0.66, 0.5714, 780, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "index", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index(request):\n return render_to_response(\"index.html\",locals()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L10_C4", "label": "return", "type": "return", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L9_C0", "vector": [13, 1, 0.5263, 0.0526, 1, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"index.html\",locals()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L12_C0", "label": "dis_info", "type": "function", "loc": [12, 13], "level": 0, "parent": null, "vector": [2, 0, 0.6579, 0.1053, 0, 0.66, 0.7143, 601, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "dis_info", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dis_info(request):\n return render_to_response(\"discount.html\",locals()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L13_C4", "label": "return", "type": "return", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L12_C0", "vector": [13, 1, 0.6842, 0.0526, 1, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"discount.html\",locals()) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L15_C0", "label": "hotel_info", "type": "function", "loc": [15, 16], "level": 0, "parent": null, "vector": [2, 0, 0.8158, 0.1053, 0, 0.66, 0.8571, 706, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "hotel_info", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def hotel_info(request):\n return render_to_response(\"hotel_info.html\",locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L16_C4", "label": "return", "type": "return", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L15_C0", "vector": [13, 1, 0.8421, 0.0526, 1, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"hotel_info.html\",locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L18_C0", "label": "flight_info", "type": "function", "loc": [18, 19], "level": 0, "parent": null, "vector": [2, 0, 0.9737, 0.1053, 0, 0.66, 1.0, 876, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "flight_info", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def flight_info(request):\n return render_to_response(\"flight_info.html\",locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L19_C4", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L18_C0", "vector": [13, 1, 1.0, 0.0526, 1, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"flight_info.html\",locals())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_838:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_838:Return_L19_C4"}] |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)
| ajibawa-2023/Python-Code-Large/train/row_839 | 8 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_839:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.47, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.47, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 1, 0.47, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 0.47, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_839:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.32, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_839:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_839:Expr_L11_C4"}] |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^iphone12580/', include('iphone12580.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^$','iphone12580.coupon.views.index'),
(r'^discount','iphone12580.coupon.views.dis_info'), #优惠券信息
(r'^hotel','iphone12580.coupon.views.hotel_info'), #酒店信息
(r'^flight','iphone12580.coupon.views.flight_info') #机票信息
(r'^test/','iphone12580.coupon.views.test'), #临时测试
)
| ajibawa-2023/Python-Code-Large/train/row_840 | 4 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_840:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_840:ImportFrom_L4_C0", "label": "from django.contrib import admin", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0455, 0, 0.66, 0.3333, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_names": ["admin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib import admin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_840:Expr_L5_C0", "label": "autodiscover()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2273, 0.0455, 0, 0.66, 0.6667, 798, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "autodiscover", "arg_names": [], "import_names": [], "rhs_call_name": "autodiscover", "annotation": ""}, "snippet": "admin.autodiscover()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_840:Assign_L7_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [7, 22], "level": 0, "parent": null, "vector": [14, 0, 0.6591, 0.7273, 0, 0.66, 1.0, 990, 3, 6, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n # Example:\n # (r'^iphone12580/', include('iphone12580.foo.urls')),\n\n # Uncomment the admin/doc line below and add 'django.contrib.admindocs' \n # to INSTALLED_APPS to enable admin documentation:\n # (r'^admin/doc/', include('django.contrib.admindocs.urls')),\n"}] | [] |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)
| ajibawa-2023/Python-Code-Large/train/row_841 | 8 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_841:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.05, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.05, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 1, 0.05, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 0.05, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_841:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.5, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_841:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_841:Expr_L11_C4"}] |
import sys
import os
from PIL import Image
def detectEdge(img, w, h):
left, upper, right, lower = w,h,0,0
pixels = img.load()
threshold = 10
for x in range(0,w):
for y in xrange(0,h):
pix = pixels[x,y]
if (pix[0]<(254-threshold) or pix[1]<(254-threshold) or pix[2]<(254-threshold)) and pix[3]>0:
left, upper, right, lower = min(x,left),min(y,upper),max(x,right),max(y,lower)
return (left, upper, right, lower)
if __name__ == '__main__':
dirList=os.listdir(sys.argv[1])
for fname in dirList:
if fname.endswith(sys.argv[3]):
img = Image.open(os.path.join(sys.argv[1],fname))
width, height = img.size
box = detectEdge(img,width,height)
print fname, box
img2 = img.crop(box)
# img2 = img2.resize((width, height), Image.ANTIALIAS)
img2 = img2.resize(((box[2]-box[0]), (box[3]-box[1])), Image.ANTIALIAS)
img2.save(os.path.join(sys.argv[2],fname))
| ajibawa-2023/Python-Code-Large/train/row_842 | 24 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_842:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0323, 0, 0.66, 0.25, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:ImportFrom_L4_C0", "label": "from PIL import Image", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.129, 0.0323, 0, 0.66, 0.5, 556, 0, 1, 0, 0, 556, 0, 0], "semantic": {"name": "PIL", "arg_names": [], "import_names": ["Image"], "rhs_call_name": "", "annotation": ""}, "snippet": "from PIL import Image"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "label": "detectEdge", "type": "function", "loc": [7, 17], "level": 0, "parent": null, "vector": [2, 0, 0.3871, 0.3548, 0, 0.66, 0.75, 280, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "detectEdge", "arg_names": ["img", "w", "h"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def detectEdge(img, w, h):\n \n left, upper, right, lower = w,h,0,0\n pixels = img.load()\n threshold = 10\n for x in range(0,w):\n for y in xrange(0,h):\n pix = pixels[x,y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L9_C4", "label": "left, upper, right, lower =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "vector": [14, 1, 0.2903, 0.0323, 1, 0.17, 0.0, 789, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "left, upper, right, lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " left, upper, right, lower = w,h,0,0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L10_C4", "label": "pixels = load()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "vector": [14, 1, 0.3226, 0.0323, 1, 0.17, 0.25, 900, 3, 0, 0, 0, 37, 10, 1], "semantic": {"name": "pixels", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " pixels = img.load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L11_C4", "label": "threshold =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "vector": [14, 1, 0.3548, 0.0323, 1, 0.17, 0.5, 635, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " threshold = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:For_L12_C4", "label": "for x", "type": "for", "loc": [12, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "vector": [6, 1, 0.4516, 0.1613, 1, 0.17, 0.75, 190, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range(0,w):\n for y in xrange(0,h):\n pix = pixels[x,y]\n if (pix[0]<(254-threshold) or pix[1]<(254-threshold) or pix[2]<(254-threshold)) and pix[3]>0:\n left, upper, right, lower = min(x,left),min(y,upper),max(x,right),max(y,lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8", "label": "for y", "type": "for", "loc": [13, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:For_L12_C4", "vector": [6, 2, 0.4677, 0.129, 2, 0.51, 0.0, 304, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in xrange(0,h):\n pix = pixels[x,y]\n if (pix[0]<(254-threshold) or pix[1]<(254-threshold) or pix[2]<(254-threshold)) and pix[3]>0:\n left, upper, right, lower = min(x,left),min(y,upper),max(x,right),max(y,lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L14_C12", "label": "pix =", "type": "assigned_variable", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8", "vector": [14, 3, 0.4516, 0.0323, 3, 0.71, 0.0, 969, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pix = pixels[x,y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:If_L15_C12", "label": "if", "type": "if", "loc": [15, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8", "vector": [4, 3, 0.5, 0.0645, 3, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (pix[0]<(254-threshold) or pix[1]<(254-threshold) or pix[2]<(254-threshold)) and pix[3]>0:\n left, upper, right, lower = min(x,left),min(y,upper),max(x,right),max(y,lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L16_C16", "label": "left, upper, right, lower =", "type": "assigned_variable", "loc": [16, 16], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L15_C12", "vector": [14, 4, 0.5161, 0.0323, 4, 0.79, 0.0, 789, 0, 0, 0, 0, 0, 8, 4], "semantic": {"name": "left, upper, right, lower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " left, upper, right, lower = min(x,left),min(y,upper),max(x,right),max(y,lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "vector": [13, 1, 0.5484, 0.0323, 1, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (left, upper, right, lower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:If_L20_C0", "label": "if", "type": "if", "loc": [20, 31], "level": 0, "parent": null, "vector": [4, 0, 0.8226, 0.3871, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__': \n dirList=os.listdir(sys.argv[1])\n for fname in dirList:\n if fname.endswith(sys.argv[3]):\n img = Image.open(os.path.join(sys.argv[1],fname))\n width, height = img.size \n box = detectEdge(img,width,height)\n print(fname, box)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L21_C4", "label": "dirList = listdir()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L20_C0", "vector": [14, 1, 0.6774, 0.0323, 1, 0.28, 0.0, 448, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "dirList", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " dirList=os.listdir(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:For_L22_C4", "label": "for fname", "type": "for", "loc": [22, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L20_C0", "vector": [6, 1, 0.8548, 0.3226, 1, 0.28, 1.0, 190, 2, 0, 0, 0, 0, 0, 9], "semantic": {"name": "fname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fname in dirList:\n if fname.endswith(sys.argv[3]):\n img = Image.open(os.path.join(sys.argv[1],fname))\n width, height = img.size \n box = detectEdge(img,width,height)\n print(fname, box)\n img2 = img.crop(box)\n # img2 = img2.resize((width, height), Image.ANTIALIAS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "label": "if", "type": "if", "loc": [23, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:For_L22_C4", "vector": [4, 2, 0.871, 0.2903, 2, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fname.endswith(sys.argv[3]):\n img = Image.open(os.path.join(sys.argv[1],fname))\n width, height = img.size \n box = detectEdge(img,width,height)\n print(fname, box)\n img2 = img.crop(box)\n # img2 = img2.resize((width, height), Image.ANTIALIAS)\n img2 = img2.resize(((box[2]-box[0]), (box[3]-box[1])), Image.ANTIALIAS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L24_C12", "label": "img = open()", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [14, 3, 0.7742, 0.0323, 3, 0.25, 0.0, 200, 3, 1, 0, 0, 693, 10, 2], "semantic": {"name": "img", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " img = Image.open(os.path.join(sys.argv[1],fname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L25_C12", "label": "width, height =", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [14, 3, 0.8065, 0.0323, 3, 0.25, 0.1667, 560, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "width, height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width, height = img.size "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L26_C12", "label": "box = detectEdge()", "type": "assigned_variable", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [14, 3, 0.8387, 0.0323, 3, 0.25, 0.3333, 918, 3, 3, 0, 0, 280, 10, 1], "semantic": {"name": "box", "arg_names": [], "import_names": [], "rhs_call_name": "detectEdge", "annotation": ""}, "snippet": " box = detectEdge(img,width,height)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Expr_L27_C12", "label": "print()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [8, 3, 0.871, 0.0323, 3, 0.25, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(fname, box)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L28_C12", "label": "img2 = crop()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [14, 3, 0.9032, 0.0323, 3, 0.25, 0.6667, 750, 3, 1, 0, 0, 405, 10, 1], "semantic": {"name": "img2", "arg_names": [], "import_names": [], "rhs_call_name": "crop", "annotation": ""}, "snippet": " img2 = img.crop(box)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L30_C12", "label": "img2 = resize()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [14, 3, 0.9677, 0.0323, 3, 0.25, 0.8333, 750, 3, 2, 0, 0, 834, 10, 1], "semantic": {"name": "img2", "arg_names": [], "import_names": [], "rhs_call_name": "resize", "annotation": ""}, "snippet": " img2 = img2.resize(((box[2]-box[0]), (box[3]-box[1])), Image.ANTIALIAS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_842:Expr_L31_C12", "label": "save()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "vector": [8, 3, 1.0, 0.0323, 3, 0.25, 1.0, 928, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " img2.save(os.path.join(sys.argv[2],fname))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:For_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:For_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L14_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:For_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:If_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L15_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L16_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_842:For_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Expr_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_842:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_842:Expr_L31_C12"}] |
# Run from the commandline:
#
# python server.py
# POST audio to http://localhost:9000
# GET audio from http://localhost:9000
#
# A simple server to collect audio using python. To be more secure,
# you might want to check the file names and place size restrictions
# on the incoming data.
import cgi
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class WamiHandler(BaseHTTPRequestHandler):
dirname = "/tmp/"
def do_GET(self):
f = open(self.get_name())
self.send_response(200)
self.send_header('content-type','audio/x-wav')
self.end_headers()
self.wfile.write(f.read())
f.close()
def do_POST(self):
f = open(self.get_name(), "wb")
# Note that python's HTTPServer doesn't support chunked transfer.
# Thus, it requires a content-length.
length = int(self.headers.getheader('content-length'))
print "POST of length " + str(length)
f.write(self.rfile.read(length))
f.close();
def get_name(self):
filename = 'output.wav';
qs = self.path.split('?',1);
if len(qs) == 2:
params = cgi.parse_qs(qs[1])
if params['name']:
filename = params['name'][0];
return WamiHandler.dirname + filename
def main():
try:
server = HTTPServer(('', 9000), WamiHandler)
print 'Started server...'
server.serve_forever()
except KeyboardInterrupt:
print 'Stopping server'
server.socket.close()
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_843 | 34 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_843:Import_L11_C0", "label": "cgi import cgi", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2075, 0.0189, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:ImportFrom_L12_C0", "label": "from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2264, 0.0189, 0, 0.66, 0.25, 801, 0, 2, 0, 0, 801, 0, 0], "semantic": {"name": "BaseHTTPServer", "arg_names": [], "import_names": ["BaseHTTPRequestHandler", "HTTPServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "label": "WamiHandler", "type": "class", "loc": [14, 41], "level": 0, "parent": null, "vector": [3, 0, 0.5189, 0.5283, 0, 0.66, 0.5, 732, 0, 3, 0, 0, 152, 0, 20], "semantic": {"name": "WamiHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WamiHandler(BaseHTTPRequestHandler):\n dirname = \"/tmp/\"\n \n def do_GET(self):\n f = open(self.get_name())\n self.send_response(200)\n self.send_header('content-type','audio/x-wav')\n self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L15_C4", "label": "dirname =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "vector": [14, 1, 0.283, 0.0189, 1, 0.77, 0.0, 959, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dirname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dirname = \"/tmp/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "label": "do_GET", "type": "function", "loc": [17, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "vector": [2, 1, 0.3774, 0.1321, 1, 0.77, 0.3333, 269, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "do_GET", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_GET(self):\n f = open(self.get_name())\n self.send_response(200)\n self.send_header('content-type','audio/x-wav')\n self.end_headers()\n self.wfile.write(f.read())\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L18_C8", "label": "f = open()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [14, 2, 0.3396, 0.0189, 2, 0.3, 0.0, 899, 3, 1, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(self.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L19_C8", "label": "send_response()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [8, 2, 0.3585, 0.0189, 2, 0.3, 0.2, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response(200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L20_C8", "label": "send_header()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [8, 2, 0.3774, 0.0189, 2, 0.3, 0.4, 81, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send_header", "arg_names": [], "import_names": [], "rhs_call_name": "send_header", "annotation": ""}, "snippet": " self.send_header('content-type','audio/x-wav')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L21_C8", "label": "end_headers()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [8, 2, 0.3962, 0.0189, 2, 0.3, 0.6, 683, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_headers", "arg_names": [], "import_names": [], "rhs_call_name": "end_headers", "annotation": ""}, "snippet": " self.end_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L22_C8", "label": "write()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [8, 2, 0.4151, 0.0189, 2, 0.3, 0.8, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.wfile.write(f.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L23_C8", "label": "close()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "vector": [8, 2, 0.434, 0.0189, 2, 0.3, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "label": "do_POST", "type": "function", "loc": [25, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "vector": [2, 1, 0.5377, 0.1509, 1, 0.77, 0.6667, 67, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "do_POST", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_POST(self):\n f = open(self.get_name(), \"wb\")\n # Note that python's HTTPServer doesn't support chunked transfer.\n # Thus, it requires a content-length.\n length = int(self.headers.getheader('content-length'))\n print(\"POST of length \" + str(length))\n f.write(self.rfile.read(length))\n f.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L26_C8", "label": "f = open()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "vector": [14, 2, 0.4906, 0.0189, 2, 0.3, 0.0, 899, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(self.get_name(), \"wb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L29_C8", "label": "length = int()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "vector": [14, 2, 0.5472, 0.0189, 2, 0.3, 0.25, 221, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " length = int(self.headers.getheader('content-length'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L30_C8", "label": "print()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "vector": [8, 2, 0.566, 0.0189, 2, 0.3, 0.5, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"POST of length \" + str(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L31_C8", "label": "write()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "vector": [8, 2, 0.5849, 0.0189, 2, 0.3, 0.75, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(self.rfile.read(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L32_C8", "label": "close()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "vector": [8, 2, 0.6038, 0.0189, 2, 0.3, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "label": "get_name", "type": "function", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "vector": [2, 1, 0.7075, 0.1509, 1, 0.77, 1.0, 770, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n filename = 'output.wav';\n qs = self.path.split('?',1);\n if len(qs) == 2:\n params = cgi.parse_qs(qs[1])\n if params['name']:\n filename = params['name'][0];\n return WamiHandler.dirname + filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L35_C8", "label": "filename =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "vector": [14, 2, 0.6604, 0.0189, 2, 0.84, 0.0, 275, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = 'output.wav';"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L36_C8", "label": "qs = split()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "vector": [14, 2, 0.6792, 0.0189, 2, 0.84, 0.3333, 251, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "qs", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " qs = self.path.split('?',1);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "vector": [4, 2, 0.7264, 0.0755, 2, 0.84, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(qs) == 2:\n params = cgi.parse_qs(qs[1])\n if params['name']:\n filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L38_C12", "label": "params = parse_qs()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8", "vector": [14, 3, 0.717, 0.0189, 3, 0.63, 0.0, 206, 3, 1, 0, 0, 709, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " params = cgi.parse_qs(qs[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:If_L39_C12", "label": "if", "type": "if", "loc": [39, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8", "vector": [4, 3, 0.7453, 0.0377, 3, 0.63, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if params['name']:\n filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L40_C16", "label": "filename =", "type": "assigned_variable", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:If_L39_C12", "vector": [14, 4, 0.7547, 0.0189, 4, 0.91, 0.0, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = params['name'][0];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "vector": [13, 2, 0.7736, 0.0189, 2, 0.84, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return WamiHandler.dirname + filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L43_C0", "label": "main", "type": "function", "loc": [43, 50], "level": 0, "parent": null, "vector": [2, 0, 0.8774, 0.1509, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n try:\n server = HTTPServer(('', 9000), WamiHandler)\n print('Started server...')\n server.serve_forever()\n except KeyboardInterrupt:\n print('Stopping server')\n server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "label": "try", "type": "try", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L43_C0", "vector": [7, 1, 0.8868, 0.1321, 1, 0.78, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n server = HTTPServer(('', 9000), WamiHandler)\n print('Started server...')\n server.serve_forever()\n except KeyboardInterrupt:\n print('Stopping server')\n server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L45_C8", "label": "server = HTTPServer()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "vector": [14, 2, 0.8491, 0.0189, 2, 0.97, 0.0, 268, 3, 2, 0, 0, 258, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " server = HTTPServer(('', 9000), WamiHandler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L46_C8", "label": "print()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "vector": [8, 2, 0.8679, 0.0189, 2, 0.97, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Started server...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L47_C8", "label": "serve_forever()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "vector": [8, 2, 0.8868, 0.0189, 2, 0.97, 1.0, 993, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "serve_forever", "arg_names": [], "import_names": [], "rhs_call_name": "serve_forever", "annotation": ""}, "snippet": " server.serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L49_C8", "label": "print()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "vector": [8, 2, 0.9245, 0.0189, 2, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Stopping server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L50_C8", "label": "close()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "vector": [8, 2, 0.9434, 0.0189, 2, 0.97, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " server.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:If_L52_C0", "label": "if", "type": "if", "loc": [52, 53], "level": 0, "parent": null, "vector": [4, 0, 0.9906, 0.0377, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L53_C4", "label": "main()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_843:If_L52_C0", "vector": [8, 1, 1.0, 0.0189, 1, 0.8, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_843:If_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:If_L39_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Return_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_843:If_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_843:Expr_L53_C4"}] |
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
DEBUG = 0
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
return -1
GPIO.output(cspin, True)
GPIO.output(clockpin, False) # start clock low
GPIO.output(cspin, False) # bring CS low
commandout = adcnum
print "---------------------------"
displayNumber("Base:", adcnum)
commandout |= 0x18 # start bit + single-ended bit
displayNumber("0x18:", adcnum)
commandout <<= 3 # we only need to send 5 bits here
for i in range(5):
displayNumber(("i:%i" % i), adcnum)
if (commandout & 0x80): # 0x80 = 10000000
GPIO.output(mosipin, True)
else:
GPIO.output(mosipin, False)
commandout <<= 1
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)
adcout = 0
# read in one empty bit, one null bit and 10 ADC bits
for i in range(12):
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)
adcout <<= 1
if (GPIO.input(misopin)):
adcout |= 0x1
displayNumber(("ADCOUT i:%i" % i), adcout)
GPIO.output(cspin, True)
adcout >>= 1 # first bit is 'null' so drop it
displayNumber("final ADCOUT:", adcout)
return adcout
def displayNumber(prefix, num):
print prefix, num, "\t", hex(num), "\t", bin(num)
# change these as desired - they're the pins connected from the
# SPI port on the ADC to the Cobbler
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25
# set up the SPI interface pins
GPIO.setup(SPIMOSI, GPIO.OUT)
GPIO.setup(SPIMISO, GPIO.IN)
GPIO.setup(SPICLK, GPIO.OUT)
GPIO.setup(SPICS, GPIO.OUT)
# 10k trim pot connected to adc #0
potentiometer_adc = 0;
last_read = 0 # this keeps track of the last potentiometer value
tolerance = 5 # to keep from being jittery we'll only change
# volume when the pot has moved more than 5 'counts'
while True:
# we'll assume that the pot didn't move
trim_pot_changed = False
# read the analog pin
trim_pot = readadc(potentiometer_adc, SPICLK, SPIMOSI, SPIMISO, SPICS)
# how much has it changed since the last read?
pot_adjust = abs(trim_pot - last_read)
if DEBUG:
print "trim_pot :", trim_pot
print "pot_adjust:", pot_adjust
print "last_read :", last_read
if ( pot_adjust > tolerance ):
trim_pot_changed = True
if DEBUG:
print "trim_pot_changed", trim_pot_changed
if ( trim_pot_changed ):
set_volume = trim_pot / 10.24 # convert 10bit adc0 (0-1024) trim pot read into 0-100 volume level
set_volume = round(set_volume) # round out decimal value
set_volume = int(set_volume) # cast volume as integer
print 'Volume = {volume}%' .format(volume = set_volume)
# set_vol_cmd = 'sudo amixer cset numid=1 -- {volume}% > /dev/null' .format(volume = set_volume)
# os.system(set_vol_cmd) # set volume
if DEBUG:
print "set_volume", set_volume
print "tri_pot_changed", set_volume
# save the potentiometer reading for the next loop
last_read = trim_pot
# hang out and do nothing for a half second
time.sleep(0.5)
| ajibawa-2023/Python-Code-Large/train/row_844 | 66 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_844:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0273, 0.0091, 0, 0.66, 0.0556, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Import_L4_C0", "label": "RPi.GPIO import GPIO", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0091, 0, 0.66, 0.1111, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "RPi.GPIO", "arg_names": [], "import_names": ["GPIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import RPi.GPIO as GPIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L6_C0", "label": "setmode()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0545, 0.0091, 0, 0.66, 0.1667, 464, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setmode", "arg_names": [], "import_names": [], "rhs_call_name": "setmode", "annotation": ""}, "snippet": "GPIO.setmode(GPIO.BCM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L7_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0636, 0.0091, 0, 0.66, 0.2222, 309, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEBUG = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "label": "readadc", "type": "function", "loc": [10, 48], "level": 0, "parent": null, "vector": [2, 0, 0.2636, 0.3545, 0, 0.66, 0.2778, 184, 0, 5, 1, 0, 0, 0, 19], "semantic": {"name": "readadc", "arg_names": ["adcnum", "clockpin", "mosipin", "misopin", "cspin"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def readadc(adcnum, clockpin, mosipin, misopin, cspin):\n if ((adcnum > 7) or (adcnum < 0)):\n return -1\n GPIO.output(cspin, True)\n\n GPIO.output(clockpin, False) # start clock low\n GPIO.output(cspin, False) # bring CS low\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8", "label": "if", "type": "if", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [4, 1, 0.1045, 0.0182, 1, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ((adcnum > 7) or (adcnum < 0)):\n return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Return_L12_C16", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8", "vector": [13, 2, 0.1091, 0.0091, 2, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L13_C8", "label": "output()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.1182, 0.0091, 1, 0.85, 0.0769, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(cspin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L15_C8", "label": "output()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.1364, 0.0091, 1, 0.85, 0.1538, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(clockpin, False) # start clock low"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L16_C8", "label": "output()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.1455, 0.0091, 1, 0.85, 0.2308, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(cspin, False) # bring CS low"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L18_C8", "label": "commandout =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [14, 1, 0.1636, 0.0091, 1, 0.85, 0.3077, 601, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "commandout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commandout = adcnum"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L19_C8", "label": "print()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.1727, 0.0091, 1, 0.85, 0.3846, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"---------------------------\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L20_C8", "label": "displayNumber()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.1818, 0.0091, 1, 0.85, 0.4615, 314, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "displayNumber", "arg_names": [], "import_names": [], "rhs_call_name": "displayNumber", "annotation": ""}, "snippet": " displayNumber(\"Base:\", adcnum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L22_C8", "label": "displayNumber()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.2, 0.0091, 1, 0.85, 0.5385, 314, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "displayNumber", "arg_names": [], "import_names": [], "rhs_call_name": "displayNumber", "annotation": ""}, "snippet": " displayNumber(\"0x18:\", adcnum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "label": "for i", "type": "for", "loc": [24, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [6, 1, 0.2545, 0.0818, 1, 0.85, 0.6154, 826, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(5):\n displayNumber((\"i:%i\" % i), adcnum)\n if (commandout & 0x80): # 0x80 = 10000000\n GPIO.output(mosipin, True)\n else:\n GPIO.output(mosipin, False)\n commandout <<= 1\n GPIO.output(clockpin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L25_C16", "label": "displayNumber()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "vector": [8, 2, 0.2273, 0.0091, 2, 0.99, 0.0, 314, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "displayNumber", "arg_names": [], "import_names": [], "rhs_call_name": "displayNumber", "annotation": ""}, "snippet": " displayNumber((\"i:%i\" % i), adcnum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16", "label": "if", "type": "if", "loc": [26, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "vector": [4, 2, 0.25, 0.0364, 2, 0.99, 0.3333, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (commandout & 0x80): # 0x80 = 10000000\n GPIO.output(mosipin, True)\n else:\n GPIO.output(mosipin, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L27_C24", "label": "output()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16", "vector": [8, 3, 0.2455, 0.0091, 3, 0.28, 0.0, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(mosipin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L29_C24", "label": "output()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16", "vector": [8, 3, 0.2636, 0.0091, 3, 0.28, 1.0, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(mosipin, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L31_C16", "label": "output()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "vector": [8, 2, 0.2818, 0.0091, 2, 0.99, 0.6667, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(clockpin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L32_C16", "label": "output()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "vector": [8, 2, 0.2909, 0.0091, 2, 0.99, 1.0, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(clockpin, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L34_C8", "label": "adcout =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [14, 1, 0.3091, 0.0091, 1, 0.85, 0.6923, 377, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "adcout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " adcout = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "label": "for i", "type": "for", "loc": [36, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [6, 1, 0.3545, 0.0636, 1, 0.85, 0.7692, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(12):\n GPIO.output(clockpin, True)\n GPIO.output(clockpin, False)\n adcout <<= 1\n if (GPIO.input(misopin)):\n adcout |= 0x1\n displayNumber((\"ADCOUT i:%i\" % i), adcout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L37_C16", "label": "output()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "vector": [8, 2, 0.3364, 0.0091, 2, 0.08, 0.0, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(clockpin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L38_C16", "label": "output()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "vector": [8, 2, 0.3455, 0.0091, 2, 0.08, 0.3333, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(clockpin, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L40_C16", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "vector": [4, 2, 0.3682, 0.0182, 2, 0.08, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (GPIO.input(misopin)):\n adcout |= 0x1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L42_C16", "label": "displayNumber()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "vector": [8, 2, 0.3818, 0.0091, 2, 0.08, 1.0, 314, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "displayNumber", "arg_names": [], "import_names": [], "rhs_call_name": "displayNumber", "annotation": ""}, "snippet": " displayNumber((\"ADCOUT i:%i\" % i), adcout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L44_C8", "label": "output()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.4, 0.0091, 1, 0.85, 0.8462, 886, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "output", "annotation": ""}, "snippet": " GPIO.output(cspin, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L47_C8", "label": "displayNumber()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [8, 1, 0.4273, 0.0091, 1, 0.85, 0.9231, 314, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "displayNumber", "arg_names": [], "import_names": [], "rhs_call_name": "displayNumber", "annotation": ""}, "snippet": " displayNumber(\"final ADCOUT:\", adcout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "vector": [13, 1, 0.4364, 0.0091, 1, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return adcout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L50_C0", "label": "displayNumber", "type": "function", "loc": [50, 51], "level": 0, "parent": null, "vector": [2, 0, 0.4591, 0.0182, 0, 0.66, 0.3333, 314, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "displayNumber", "arg_names": ["prefix", "num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def displayNumber(prefix, num):\n print(prefix, num, \"\\t\", hex(num), \"\\t\", bin(num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L51_C2", "label": "print()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L50_C0", "vector": [8, 1, 0.4636, 0.0091, 1, 0.44, 0.0, 535, 3, 6, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(prefix, num, \"\\t\", hex(num), \"\\t\", bin(num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L55_C0", "label": "SPICLK =", "type": "assigned_variable", "loc": [55, 55], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0091, 0, 0.66, 0.3889, 546, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SPICLK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SPICLK = 18"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L56_C0", "label": "SPIMISO =", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.5091, 0.0091, 0, 0.66, 0.4444, 247, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SPIMISO", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SPIMISO = 23"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L57_C0", "label": "SPIMOSI =", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.5182, 0.0091, 0, 0.66, 0.5, 336, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SPIMOSI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SPIMOSI = 24"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L58_C0", "label": "SPICS =", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.5273, 0.0091, 0, 0.66, 0.5556, 371, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SPICS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SPICS = 25"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L61_C0", "label": "setup()", "type": "expression", "loc": [61, 61], "level": 0, "parent": null, "vector": [8, 0, 0.5545, 0.0091, 0, 0.66, 0.6111, 234, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "GPIO.setup(SPIMOSI, GPIO.OUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L62_C0", "label": "setup()", "type": "expression", "loc": [62, 62], "level": 0, "parent": null, "vector": [8, 0, 0.5636, 0.0091, 0, 0.66, 0.6667, 234, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "GPIO.setup(SPIMISO, GPIO.IN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L63_C0", "label": "setup()", "type": "expression", "loc": [63, 63], "level": 0, "parent": null, "vector": [8, 0, 0.5727, 0.0091, 0, 0.66, 0.7222, 234, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "GPIO.setup(SPICLK, GPIO.OUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L64_C0", "label": "setup()", "type": "expression", "loc": [64, 64], "level": 0, "parent": null, "vector": [8, 0, 0.5818, 0.0091, 0, 0.66, 0.7778, 234, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "GPIO.setup(SPICS, GPIO.OUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L67_C0", "label": "potentiometer_adc =", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.6091, 0.0091, 0, 0.66, 0.8333, 983, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "potentiometer_adc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "potentiometer_adc = 0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L69_C0", "label": "last_read =", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.6273, 0.0091, 0, 0.66, 0.8889, 107, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "last_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "last_read = 0 # this keeps track of the last potentiometer value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L70_C0", "label": "tolerance =", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0091, 0, 0.66, 0.9444, 632, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tolerance", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "tolerance = 5 # to keep from being jittery we'll only change"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "label": "while", "type": "while", "loc": [73, 110], "level": 0, "parent": null, "vector": [5, 0, 0.8318, 0.3455, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while True:\n # we'll assume that the pot didn't move\n trim_pot_changed = False\n\n # read the analog pin\n trim_pot = readadc(potentiometer_adc, SPICLK, SPIMOSI, SPIMISO, SPICS)\n # how much has it changed since the last read?\n pot_adjust = abs(trim_pot - last_read)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L75_C8", "label": "trim_pot_changed =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [14, 1, 0.6818, 0.0091, 1, 0.18, 0.0, 599, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "trim_pot_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " trim_pot_changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L78_C8", "label": "trim_pot = readadc()", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [14, 1, 0.7091, 0.0091, 1, 0.18, 0.1429, 249, 3, 5, 0, 0, 184, 10, 1], "semantic": {"name": "trim_pot", "arg_names": [], "import_names": [], "rhs_call_name": "readadc", "annotation": ""}, "snippet": " trim_pot = readadc(potentiometer_adc, SPICLK, SPIMOSI, SPIMISO, SPICS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L80_C8", "label": "pot_adjust = abs()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [14, 1, 0.7273, 0.0091, 1, 0.18, 0.2857, 727, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "pot_adjust", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " pot_adjust = abs(trim_pot - last_read)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "label": "if", "type": "if", "loc": [82, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [4, 1, 0.7591, 0.0364, 1, 0.18, 0.4286, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DEBUG:\n print(\"trim_pot :\", trim_pot)\n print(\"pot_adjust:\", pot_adjust)\n print(\"last_read :\", last_read)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L83_C16", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "vector": [8, 2, 0.7545, 0.0091, 2, 0.52, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"trim_pot :\", trim_pot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L84_C16", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "vector": [8, 2, 0.7636, 0.0091, 2, 0.52, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"pot_adjust:\", pot_adjust)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L85_C16", "label": "print()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "vector": [8, 2, 0.7727, 0.0091, 2, 0.52, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"last_read :\", last_read)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L87_C8", "label": "if", "type": "if", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [4, 1, 0.7955, 0.0182, 1, 0.18, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( pot_adjust > tolerance ):\n trim_pot_changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L88_C15", "label": "trim_pot_changed =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L87_C8", "vector": [14, 2, 0.8, 0.0091, 2, 0.16, 0.0, 599, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "trim_pot_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " trim_pot_changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L90_C8", "label": "if", "type": "if", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [4, 1, 0.8227, 0.0182, 1, 0.18, 0.7143, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DEBUG:\n print(\"trim_pot_changed\", trim_pot_changed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L91_C16", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L90_C8", "vector": [8, 2, 0.8273, 0.0091, 2, 0.88, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"trim_pot_changed\", trim_pot_changed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "label": "if", "type": "if", "loc": [93, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [4, 1, 0.9091, 0.1364, 1, 0.18, 0.8571, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( trim_pot_changed ):\n set_volume = trim_pot / 10.24 # convert 10bit adc0 (0-1024) trim pot read into 0-100 volume level\n set_volume = round(set_volume) # round out decimal value\n set_volume = int(set_volume) # cast volume as integer\n\n print('Volume = {volume}%' .format(volume = set_volume))\n # set_vol_cmd = 'sudo amixer cset numid=1 -- {volume}% > /dev/null' .format(volume = set_volume)\n # os.system(set_vol_cmd) # set volume"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L94_C16", "label": "set_volume =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [14, 2, 0.8545, 0.0091, 2, 0.73, 0.0, 724, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "set_volume", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " set_volume = trim_pot / 10.24 # convert 10bit adc0 (0-1024) trim pot read into 0-100 volume level"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L95_C16", "label": "set_volume = round()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [14, 2, 0.8636, 0.0091, 2, 0.73, 0.2, 724, 3, 1, 0, 0, 19, 10, 1], "semantic": {"name": "set_volume", "arg_names": [], "import_names": [], "rhs_call_name": "round", "annotation": ""}, "snippet": " set_volume = round(set_volume) # round out decimal value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L96_C16", "label": "set_volume = int()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [14, 2, 0.8727, 0.0091, 2, 0.73, 0.4, 724, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "set_volume", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " set_volume = int(set_volume) # cast volume as integer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L98_C16", "label": "print()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [8, 2, 0.8909, 0.0091, 2, 0.73, 0.6, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Volume = {volume}%' .format(volume = set_volume))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16", "label": "if", "type": "if", "loc": [102, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [4, 2, 0.9364, 0.0273, 2, 0.73, 0.8, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DEBUG:\n print(\"set_volume\", set_volume)\n print(\"tri_pot_changed\", set_volume)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L103_C24", "label": "print()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16", "vector": [8, 3, 0.9364, 0.0091, 3, 0.92, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"set_volume\", set_volume)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L104_C24", "label": "print()", "type": "expression", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16", "vector": [8, 3, 0.9455, 0.0091, 3, 0.92, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"tri_pot_changed\", set_volume)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L107_C16", "label": "last_read =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "vector": [14, 2, 0.9727, 0.0091, 2, 0.73, 1.0, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_read = trim_pot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L110_C8", "label": "sleep()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "vector": [8, 1, 1.0, 0.0091, 1, 0.18, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.5)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Return_L12_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L27_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L26_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L29_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L31_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L32_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:For_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L42_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L85_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L88_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L103_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L102_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L104_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Assign_L107_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_844:While_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_844:Expr_L110_C8"}] |
#coding=utf8
from django.db import models
class Address(models.Model):
name = models.CharField(max_length=20)
address = models.CharField(max_length=100)
pub_date = models.DateField()
| ajibawa-2023/Python-Code-Large/train/row_845 | 5 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_845:ImportFrom_L2_C0", "label": "from django.db import models", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.1429, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "label": "Address", "type": "class", "loc": [4, 7], "level": 0, "parent": null, "vector": [3, 0, 0.7857, 0.5714, 0, 0.66, 1.0, 149, 0, 0, 0, 0, 996, 0, 3], "semantic": {"name": "Address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Address(models.Model):\n name = models.CharField(max_length=20)\n address = models.CharField(max_length=100)\n pub_date = models.DateField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L5_C3", "label": "name = CharField()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "vector": [14, 1, 0.7143, 0.1429, 1, 0.28, 0.0, 57, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = models.CharField(max_length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L6_C3", "label": "address = CharField()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "vector": [14, 1, 0.8571, 0.1429, 1, 0.28, 0.5, 666, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "address", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " address = models.CharField(max_length=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L7_C3", "label": "pub_date = DateField()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "vector": [14, 1, 1.0, 0.1429, 1, 0.28, 1.0, 365, 3, 0, 0, 0, 847, 10, 1], "semantic": {"name": "pub_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateField", "annotation": ""}, "snippet": " pub_date = models.DateField()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L5_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L6_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_845:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_845:Assign_L7_C3"}] |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
| ajibawa-2023/Python-Code-Large/train/row_846 | 6 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2188, 0.375, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_846:ImportFrom_L8_C0", "label": "from django.test import TestCase", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0625, 0, 0.66, 0.5, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_846:ClassDef_L11_C0", "label": "SimpleTest", "type": "class", "loc": [11, 16], "level": 0, "parent": null, "vector": [3, 0, 0.8438, 0.375, 0, 0.66, 1.0, 47, 0, 1, 0, 0, 3, 0, 1], "semantic": {"name": "SimpleTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SimpleTest(TestCase):\n def test_basic_addition(self):\n \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\"\n self.assertEqual(1 + 1, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "label": "test_basic_addition", "type": "function", "loc": [12, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_846:ClassDef_L11_C0", "vector": [2, 1, 0.875, 0.3125, 1, 0.68, 0.0, 153, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "test_basic_addition", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_basic_addition(self):\n \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\"\n self.assertEqual(1 + 1, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L13_C8", "label": "expression", "type": "expression", "loc": [13, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "vector": [8, 2, 0.875, 0.1875, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Tests that 1 + 1 always equals 2.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L16_C8", "label": "assertEqual()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "vector": [8, 2, 1.0, 0.0625, 2, 0.23, 1.0, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1 + 1, 2)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_846:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_846:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_846:Expr_L16_C8"}] |
from django.conf.urls.defaults import patterns, url
__author__ = 'Administrator'
urlpatterns = patterns('address.views',
url(r'^test/$','test')
) | ajibawa-2023/Python-Code-Large/train/row_847 | 3 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_847:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 341, 0, 2, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["patterns", "url"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import patterns, url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_847:Assign_L3_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.1667, 0, 0.66, 0.5, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Administrator'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_847:Assign_L4_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [4, 6], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.5, 0, 0.66, 1.0, 990, 3, 2, 0, 0, 75, 10, 2], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('address.views',\n url(r'^test/$','test')\n)"}] | [] |
from django.contrib import admin
from address.models import Address
__author__ = 'Administrator'
admin.site.register(Address) | ajibawa-2023/Python-Code-Large/train/row_848 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_848:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_names": ["admin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib import admin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_848:ImportFrom_L2_C0", "label": "from address.models import Address", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.3333, 980, 0, 1, 0, 0, 980, 0, 0], "semantic": {"name": "address.models", "arg_names": [], "import_names": ["Address"], "rhs_call_name": "", "annotation": ""}, "snippet": "from address.models import Address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_848:Assign_L3_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.2, 0, 0.66, 0.6667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Administrator'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_848:Expr_L5_C0", "label": "register()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.2, 0, 0.66, 1.0, 276, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "admin.site.register(Address)"}] | [] |
# Create your views here.
import urllib2
from django.http import HttpResponse
from django.shortcuts import render_to_response
from models import Address
def latest_address(request):
addresslist = Address.objects.order_by('-pub_date')[:10]
return render_to_response('latest_address.html', {'addresslist':addresslist})
def test(request):
ret = urllib2.urlopen("http://friend.renren.com/GetFriendList.do?id=227638867").read()
print ret
return HttpResponse(ret) | ajibawa-2023/Python-Code-Large/train/row_849 | 11 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_849:Import_L2_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:ImportFrom_L3_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.2143, 0.0714, 0, 0.66, 0.2, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:ImportFrom_L4_C0", "label": "from django.shortcuts import render_to_response", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0714, 0, 0.66, 0.4, 852, 0, 1, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.shortcuts import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:ImportFrom_L5_C0", "label": "from models import Address", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.3571, 0.0714, 0, 0.66, 0.6, 495, 0, 1, 0, 0, 495, 0, 0], "semantic": {"name": "models", "arg_names": [], "import_names": ["Address"], "rhs_call_name": "", "annotation": ""}, "snippet": "from models import Address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "label": "latest_address", "type": "function", "loc": [7, 9], "level": 0, "parent": null, "vector": [2, 0, 0.5714, 0.2143, 0, 0.66, 0.8, 958, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "latest_address", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def latest_address(request):\n addresslist = Address.objects.order_by('-pub_date')[:10]\n return render_to_response('latest_address.html', {'addresslist':addresslist})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:Assign_L8_C4", "label": "addresslist =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "vector": [14, 1, 0.5714, 0.0714, 1, 0.19, 0.0, 133, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "addresslist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " addresslist = Address.objects.order_by('-pub_date')[:10]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:Return_L9_C4", "label": "return", "type": "return", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "vector": [13, 1, 0.6429, 0.0714, 1, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response('latest_address.html', {'addresslist':addresslist})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "label": "test", "type": "function", "loc": [11, 14], "level": 0, "parent": null, "vector": [2, 0, 0.8929, 0.2857, 0, 0.66, 1.0, 224, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "test", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(request):\n ret = urllib2.urlopen(\"http://friend.renren.com/GetFriendList.do?id=227638867\").read()\n print(ret)\n return HttpResponse(ret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:Assign_L12_C4", "label": "ret = read()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "vector": [14, 1, 0.8571, 0.0714, 1, 0.88, 0.0, 501, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " ret = urllib2.urlopen(\"http://friend.renren.com/GetFriendList.do?id=227638867\").read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:Expr_L13_C4", "label": "print()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "vector": [8, 1, 0.9286, 0.0714, 1, 0.88, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_849:Return_L14_C4", "label": "return", "type": "return", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "vector": [13, 1, 1.0, 0.0714, 1, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(ret)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_849:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_849:Return_L14_C4"}] |
from BeautifulSoup import BeautifulSoup
__author__ = 'Administrator'
import urllib,urllib2,cookielib
from BeautifulSoup import BeautifulSoup
myCookie = urllib2.HTTPCookieProcessor(cookielib.CookieJar())
openner = urllib2.build_opener(myCookie)
post_data = {'email':'yinjj472@nenu.edu.cn',
'password':'112074',
'origURL':'http://www.renren.com/Home.do',
'domain':'renren.com'}
req = urllib2.Request('http://www.renren.com/PLogin.do', urllib.urlencode(post_data))
html_src = openner.open(req).read()
#print(html_src),"####################"
#parser = BeautifulSoup(html_src)
#
#article_list = parser.find('div', 'feed-list').findAll('article')
#for my_article in article_list:
# state = []
# for my_tag in my_article.h3.contents:
# factor = my_tag.string
# if factor != None:
# factor = factor.replace(u'\xa0','')
# factor = factor.strip(u'\r\n')
# factor = factor.strip(u'\n')
# state.append(factor)
# print ' '.join(state)
req = urllib2.Request('http://friend.renren.com/GetFriendList.do?curpage=2&id=227638867')
html_src = openner.open(req).read()
print(html_src) | ajibawa-2023/Python-Code-Large/train/row_850 | 12 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_850:ImportFrom_L1_C0", "label": "from BeautifulSoup import BeautifulSoup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "BeautifulSoup", "arg_names": [], "import_names": ["BeautifulSoup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from BeautifulSoup import BeautifulSoup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L3_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0938, 0.0312, 0, 0.66, 0.0909, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Administrator'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Import_L5_C0", "label": "urllib import urllib, urllib2, cookielib", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1562, 0.0312, 0, 0.66, 0.1818, 614, 0, 3, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib", "urllib2", "cookielib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib,urllib2,cookielib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:ImportFrom_L6_C0", "label": "from BeautifulSoup import BeautifulSoup", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1875, 0.0312, 0, 0.66, 0.2727, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "BeautifulSoup", "arg_names": [], "import_names": ["BeautifulSoup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from BeautifulSoup import BeautifulSoup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L7_C0", "label": "myCookie = HTTPCookieProcessor()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.2188, 0.0312, 0, 0.66, 0.3636, 948, 3, 1, 0, 0, 822, 10, 2], "semantic": {"name": "myCookie", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPCookieProcessor", "annotation": ""}, "snippet": "myCookie = urllib2.HTTPCookieProcessor(cookielib.CookieJar())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L8_C0", "label": "openner = build_opener()", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0312, 0, 0.66, 0.4545, 562, 3, 1, 0, 0, 207, 10, 1], "semantic": {"name": "openner", "arg_names": [], "import_names": [], "rhs_call_name": "build_opener", "annotation": ""}, "snippet": "openner = urllib2.build_opener(myCookie)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L10_C0", "label": "post_data =", "type": "assigned_variable", "loc": [10, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3594, 0.125, 0, 0.66, 0.5455, 743, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "post_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "post_data = {'email':'yinjj472@nenu.edu.cn',\n 'password':'112074',\n 'origURL':'http://www.renren.com/Home.do',\n 'domain':'renren.com'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L14_C0", "label": "req = Request()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.4375, 0.0312, 0, 0.66, 0.6364, 233, 3, 2, 0, 0, 51, 10, 2], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "Request", "annotation": ""}, "snippet": "req = urllib2.Request('http://www.renren.com/PLogin.do', urllib.urlencode(post_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L15_C0", "label": "html_src = read()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.4688, 0.0312, 0, 0.66, 0.7273, 599, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "html_src", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "html_src = openner.open(req).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L30_C0", "label": "req = Request()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.9375, 0.0312, 0, 0.66, 0.8182, 233, 3, 1, 0, 0, 51, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "Request", "annotation": ""}, "snippet": "req = urllib2.Request('http://friend.renren.com/GetFriendList.do?curpage=2&id=227638867')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Assign_L31_C0", "label": "html_src = read()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.9688, 0.0312, 0, 0.66, 0.9091, 599, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "html_src", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "html_src = openner.open(req).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_850:Expr_L32_C0", "label": "print()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0312, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(html_src)"}] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.